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
 SQL Server 2008 Forums
 Transact-SQL (2008)
 insert data from temp table into table in database
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Junior Sqler
Starting Member

18 Posts

Posted - 05/09/2013 :  06:00:29  Show Profile  Reply with Quote
Hi!
My question is the following i have created a table in database:

Create table status
(
A int,
B VARCHAR(20),
C VARCHAR(20),
D varchar(20) )

and i want to fill it in with data from a temp table (#temp):

insert into status (A,B,C,D)
select( a.A,a.B,a.C,'oK')
from #temp a

but the following message appears:
Incorrect syntax near ',' (in line with select)

What is wrong? Could anyone help me?

visakh16
Very Important crosS Applying yaK Herder

India
52309 Posts

Posted - 05/09/2013 :  07:02:17  Show Profile  Reply with Quote
it should be

insert status (A,B,C,D) 
select  A,B,C,'OK'
from #temp 


------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page

Junior Sqler
Starting Member

18 Posts

Posted - 05/09/2013 :  07:27:34  Show Profile  Reply with Quote
thank you!!
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
52309 Posts

Posted - 05/09/2013 :  07:33:52  Show Profile  Reply with Quote
welcome

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
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.06 seconds. Powered By: Snitz Forums 2000