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
 General SQL Server Forums
 New to SQL Server Programming
 split and insert record

Author  Topic 

shanmugaraj
Posting Yak Master

219 Posts

Posted - 2013-04-24 : 08:59:08
I have emp_code value from sp in set of records.
i want to insert into emp_master table
please help me with query...


INSERT INTO emp_master( emp_code, location_id,gender_id) Values
(
select * from dbo.split('1234580237,1234580238,1234580239,1234580240',',')
, 3
, 1)


THANKS
SHANMUGARAJ
nshanmugaraj@gmail.com

James K
Master Smack Fu Yak Hacker

3873 Posts

Posted - 2013-04-24 : 09:06:07
Should be more like this:
INSERT INTO emp_master( emp_code, location_id,gender_id) 
select ColName,3,1 from dbo.split('1234580237,1234580238,1234580239,1234580240',',')
The red ColName is the name of the column that your split function returns. You could try using *,3,1 instead of ColName,3,1 if split function returns only one column.
Go to Top of Page

shanmugaraj
Posting Yak Master

219 Posts

Posted - 2013-04-24 : 09:10:09
Thanks James

THANKS
SHANMUGARAJ
nshanmugaraj@gmail.com
Go to Top of Page
   

- Advertisement -