Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Generic Query Question [?]

Author  Topic 

sneethling
Starting Member

22 Posts

Posted - 2001-03-06 : 08:58:25
I need a generic query which will generate insert statements of all the existing records in a table. This is to load a DB with default data for implementation purpose. (I'm getting lost when I have to declare or determine the column datatype, which is located in syscolumns)

Example of Query results for table SHIFTS must look like this:
INSERT SHIFTS (SHIFT_CODE, DESCRIPTION) VALUES("D", "Day Shift")
INSERT SHIFTS (SHIFT_CODE, DESCRIPTION) VALUES("N", "Night Shift")

OR for table BIN_TRAN must look like this:

INSERT BIN_TRAN(TRAN_NO, FROM_ID, TO_ID) VALUES(1, "Kosie", "Jannie")
INSERT BIN_TRAN(TRAN_NO, FROM_ID, TO_ID) VALUES(2, "Sarel", "Kosie")
   

- Advertisement -