Jump to content

two questions: compare against null and insert into


voodoochicken

Recommended Posts

hi, as the title suggests, there are two different questions:1- how do you compare a null value in a condition, say, something like select whatever etc where some_field=null2- when you use 'insert into', do you have to declare previously the table where you want to insert, or the insert into does create the table3- ok, three questions: is there any command to check existence of a table or a procedure or an index? something like if table_name exists do whatever or if procedure_name exists do whatever else whatever_else?tnx

Link to comment
Share on other sites

1- how do you compare a null value in a condition, say, something like select whatever etc where some_field=null
That's right
2- when you use 'insert into', do you have to declare previously the table where you want to insert, or the insert into does create the table
You have to do INSERT INTO table VALUES (...). If there is no table the query will fail, you have to create one first.
3- ok, three questions: is there any command to check existence of a table or a procedure or an index? something like if table_name exists do whatever or if procedure_name exists do whatever else whatever_else?
To check the existence of a table, you can do CHECK TABLE table_name, if there is no table the column Msg_type will be "error" and the Msg_text will be "Table 'database.table_name' doesn't exist". Not sure about the others...
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...