5
Contributors
8
Replies
11
Views
7 Years
Discussion Span
Last Post by vs.vaidyanathan
1
select count(*) from information_schema.tables where table_name='SEARCH_TABLE_NAME' AND TABLE_SCHEMA='SEARCH_DATABASE_NAME'

OR
If you want to create new table you may also use

create or replace syntax........

0

Be aware that other database engines provide this information in other ways. So far as I know, every engine gives you some way to do this programmatically; and so far as I know, every database engine has associated documentation about how to do it.

0

OR

...

CREATE TABLE IF NOT EXISTS tbl_name

This doesn't seem to work... reports a syntax error near IF.hmmmm....:-/

0

getting msg 156, level 15, state 2
syntax error near keyword 'if'
msg 102, level 15, state 1
syntax error near keyword 'exists'
So tried the workaround at microsoft which suggested i put the semicolon on the previous statements, that only threw up the same error twice more.The microsoft site says something about a compatiblity issue which i'm not sure i understand. Some help pl?

0

Be aware that other database engines provide this information in other ways. So far as I know, every engine gives you some way to do this programmatically; and so far as I know, every database engine has associated documentation about how to do it.

CREATE TABLE abc
Msg 102, Level 15, State 1
Server 'XYZ', Line 1
Incorrect syntax near 'abc'.
DB-Library error:
General SQL Server error: Check messages from the SQL Server.
Tried with and without the ; on this line as well as the previous query. Nothing seems to work... frusty...

0

@raja thanks for the link. It was informative but the site talks about MySQL statements. My requirement is a server program.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.