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 2005 Forums
 Transact-SQL (2005)
 split

Author  Topic 

haroon2k9
Constraint Violating Yak Guru

328 Posts

Posted - 2010-11-09 : 02:05:36
Let say,i have a TABLEA,2 fields

id(primarykey,auto gen)
casename (varchar)

Add Logic:
if i passs the param as test to the TAbleA and param2 as 100;200;300
PLEASE see the table below and this scope identity of tableA,
passed to the TableB OF Id Column and userid splitted by ; and inserted like of TableB..
PLEASE see TableB


TABLEA


ID CASENAME

1 TEST


TABLEB:

PKID ID USERID

1 1 100
2 1 200
3 1 300

i mean if userid passed as single then 1 record to be inserted else spllitted by ; and insertion.....

Sachin.Nand

2937 Posts

Posted - 2010-11-09 : 02:16:38
It's difficult to understand what you want.

PBUH

Go to Top of Page

pk_bohra
Master Smack Fu Yak Hacker

1182 Posts

Posted - 2010-11-09 : 02:27:55
What i understand is that you are going to insert the data through stored procedure. The SP have two parameters.

The first parameter will go in TableA and SecondParameter will go in TableB (After splitting the csv value as individual row).

The first table(TableA) have an identity field which needs to be captured upon inserting the new records and the same value needs to be inserted in tableB against the csv separated values.

Let me know if my understanding is correct ?
Go to Top of Page
   

- Advertisement -