SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 split and insert record
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

shanmugaraj
Posting Yak Master

219 Posts

Posted - 04/24/2013 :  08:59:08  Show Profile  Send shanmugaraj a Yahoo! Message  Reply with Quote
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
Flowing Fount of Yak Knowledge

3758 Posts

Posted - 04/24/2013 :  09:06:07  Show Profile  Reply with Quote
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 - 04/24/2013 :  09:10:09  Show Profile  Send shanmugaraj a Yahoo! Message  Reply with Quote
Thanks James

THANKS
SHANMUGARAJ
nshanmugaraj@gmail.com
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.05 seconds. Powered By: Snitz Forums 2000