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)
 How to insert test data

Author  Topic 

Mondeo
Constraint Violating Yak Guru

287 Posts

Posted - 2009-03-09 : 19:26:40
Hi,

Whats the correct syntax for this

INSERT INTO jobs (jobid,addressid,status)
SELECT (69,SELECT addressid FROM tblEmailAddresses WHERE emailaddress LIKE '%.com%',0)

Thanks

guptam
Posting Yak Master

161 Posts

Posted - 2009-03-09 : 20:13:18
Try ..

INSERT INTO JOBS (JobID, AddressID, Status)
SELECT 69, AddressID, 0 FROM tblEmailAddress WHERE emailAddress LIKE '%.Com%'



--
Mohit K. Gupta
B.Sc. CS, Minor Japanese
MCITP: Database Administrator
MCTS: SQL Server 2005
http://sqllearnings.blogspot.com/
Go to Top of Page

Nageswar9
Aged Yak Warrior

600 Posts

Posted - 2009-03-09 : 23:30:55
This is syntax for insert statements:


suppose if u want to insert the values using input paramters:
INSERT INTO jobs (jobid,addressid,status)
values
(
69,@addressid ,0
)

Insert into Jobs (jobid,addressid,status)
select 69,addressid,0 from tblEmailAddresses WHERE emailaddress LIKE '%.com%'


Go to Top of Page
   

- Advertisement -