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.
| Author |
Topic |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2005-01-04 : 08:47:03
|
| Renjith Chembakarayil writes "hello to sql team ..Im facing a problem here .. since im new to sql procs,cursors and udf's ive no idea hw to solve my problem:I've 3 Tables FIN_PurchaseVoucher(PK-PVGID), FIN_Invoice(PK-InvoiceGID) & FIN_PVInvoice(PK- PVFID,InvoiceFID)What i want to do is while inserting a new row in FIN_PurchaseVoucher all the required FIN_Invoice rows required ie. comma seperated InvoiceGIDs supplied - 1,2,3,10.. etc. & the AutoGenerated ID (@@IDENTITY) of the new row of FIN_PurchaseVoucher be inserted into multiple rows of FIN_PVInvoiceie. if the new auto-id of FIN_PurchaseVoucher is PVGID = 25 & the req. InvoiceGID's are 1,2,3,10 then the entries of the table FIN_PVInvoice should be immediately these :PVFID | InvoiceFID----------------------25 | 125 | 225 | 325 | 10i wrote up the description coz i cudnt explain it in any shorter method .. i'll be using this in a procedure ...thanx - any help appreciated if it is fast ... :-)-- Renjith Chembakarayil" |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2005-01-04 : 09:21:22
|
| Turn the csv into a table and join to it for the insert.seehttp://www.mindsdoor.net/SQLTsql/ParseCSVString.htmlfor a function to return a table from a csv string.==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
|
|
|