Updating or Maintaining structure of Database
-
Hi, How can i check the structure of a database in mssql server? What I mean is I need a function or script which creates the table in the database if that table doesnot exist, and moreover i also need to check the existence of columns in a given table and also check if it's datatype is valid or not,if it is a primary key and so on and so forth. What I need is just a routine or a sql script to check the data structure of a database?
-
Hi, How can i check the structure of a database in mssql server? What I mean is I need a function or script which creates the table in the database if that table doesnot exist, and moreover i also need to check the existence of columns in a given table and also check if it's datatype is valid or not,if it is a primary key and so on and so forth. What I need is just a routine or a sql script to check the data structure of a database?
You can use
IF EXISTS
to check if most database objects exist or not. This can be tables, and stored procedures. Give google a shot and it'll turn up a bit of good stuff for you :-D"I guess it's what separates the professionals from the drag and drop, girly wirly, namby pamby, wishy washy, can't code for crap types." - Pete O'Hanlon