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)
 Insert statement script generator

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-03-08 : 08:52:31
Stephan writes "SQL Version 7.00.961
I need a generic query which will generate insert statements of all the existing records in a table. This 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 -