Quote Originally Posted by szlamany
We seed data in our deployed systems with .SQL scripts like this - that run in QA or with ISQL/OSQL (can never remember which one!)...

Code:
USE Acctfiles
GO
delete from ledger_t
delete from invoice_t
delete from po_t
.
.
.
delete from cycle_t
delete from batch_t
delete from vendor_t
Go
PRINT 'About to Insert Invoice_T_0'
BULK INSERT Invoice_T FROM "c:\acs desktop\textoutput acct\Invoice_T_0.txt" WITH
(KEEPIDENTITY
)
GO
PRINT 'About to Insert Po_T_0'
BULK INSERT Po_T FROM "c:\acs desktop\textoutput acct\Po_T_0.txt" WITH
(KEEPIDENTITY
)
GO

BULK INSERT ShipTo_T FROM "c:\acs desktop\acctfiles\ShipTo_T.txt" WITH
(KEEPIDENTITY
)
GO
BULK INSERT GLFund_T FROM "c:\acs desktop\acctfiles\GLFund_T.txt" WITH
(KEEPIDENTITY
)
GO
BULK INSERT GLObject_T FROM "c:\acs desktop\acctfiles\GLObject_T.txt" WITH
(KEEPIDENTITY
)
GO
BULK INSERT GLSubObj_T FROM "c:\acs desktop\acctfiles\GLSubObj_T.txt" WITH
(KEEPIDENTITY
)
GO
BULK INSERT SLType_T FROM "c:\acs desktop\acctfiles\SLType_T.txt" WITH
(KEEPIDENTITY
)
GO
BULK INSERT SLFund_T FROM "c:\acs desktop\acctfiles\SLFund_T.txt" WITH
(KEEPIDENTITY
)
GO
BULK INSERT SLRcvType_T FROM "c:\acs desktop\acctfiles\SLRcvType_T.txt" WITH
(KEEPIDENTITY
)
GO
BULK INSERT SLOrg_T FROM "c:\acs desktop\acctfiles\SLOrg_T.txt" WITH
(KEEPIDENTITY
)
GO
BULK INSERT SLFunc_T FROM "c:\acs desktop\acctfiles\SLFunc_T.txt" WITH
(KEEPIDENTITY
)
GO
BULK INSERT SLObj_T FROM "c:\acs desktop\acctfiles\SLObj_T.txt" WITH
(KEEPIDENTITY
)
GO
BULK INSERT SLSubObj_T FROM "c:\acs desktop\acctfiles\SLSubObj_T.txt" WITH
(KEEPIDENTITY
)
GO
BULK INSERT SLSchObj_T FROM "c:\acs desktop\acctfiles\SLSchObj_T.txt" WITH
(KEEPIDENTITY
)
GO
BULK INSERT SLSchProgram_T FROM "c:\acs desktop\acctfiles\SLSchProgram_T.txt" WITH
(KEEPIDENTITY
)
GO
BULK INSERT SLSchDept_T FROM "c:\acs desktop\acctfiles\SLSchDept_T.txt" WITH
(KEEPIDENTITY
)
GO
BULK INSERT SLASN_T FROM "c:\acs desktop\acctfiles\SLASN_T.txt" WITH
(KEEPIDENTITY
)
GO
BULK INSERT SLYear_T FROM "c:\acs desktop\acctfiles\SLYear_T.txt" WITH
(KEEPIDENTITY
)
GO
BULK INSERT GLAcct_T FROM "c:\acs desktop\acctfiles\GLAcct_T.txt" WITH
(KEEPIDENTITY
)
GO
PRINT 'About to Insert Control_T'
BULK INSERT Control_T FROM "c:\acs desktop\acctfiles\Control_T.txt" WITH
(KEEPIDENTITY
)
GO
PRINT 'About to Insert Cycle_T'
BULK INSERT Cycle_T FROM "c:\acs desktop\acctfiles\Cycle_T.txt" WITH
(KEEPIDENTITY
)
GO
PRINT 'About to Insert Batch_T'
BULK INSERT Batch_T FROM "c:\acs desktop\acctfiles\Batch_T.txt" WITH
(KEEPIDENTITY
)
GO
PRINT 'About to Insert Vendor_T'
BULK INSERT Vendor_T FROM "c:\acs desktop\acctfiles\Vendor_T.txt" WITH
(KEEPIDENTITY
)
GO
PRINT 'About to Insert Check_T'
BULK INSERT Check_T FROM "c:\acs desktop\acctfiles\Check_T.txt" WITH
(KEEPIDENTITY
)
GO
PRINT 'About to Insert Invoice_T'
BULK INSERT Invoice_T FROM "c:\acs desktop\acctfiles\Invoice_T.txt" WITH
(KEEPIDENTITY
)
GO
PRINT 'About to Insert Po_T'
BULK INSERT Po_T FROM "c:\acs desktop\acctfiles\Po_T.txt" WITH
(KEEPIDENTITY
)
GO
PRINT 'About to Insert Ledger_T'
BULK INSERT Ledger_T FROM "c:\acs desktop\acctfiles\Ledger_T.txt" WITH
(KEEPIDENTITY
)
GO
Mendhak - I'm still unclear on why you need to build INSERT statements to insert data into tables that you know the structure of in advance.
Ah, I see what you're doing in your code, and that had not occurred to me.

I wanted to generate INSERT statements like that because I didn't really want to type out the entire INSERT statement of a say, 60 column table.

Your method actually looks pretty good though.