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)
 INSERT WHERE

Author  Topic 

sfjtraps
Yak Posting Veteran

65 Posts

Posted - 2009-03-06 : 09:11:16
I want to insert data into a sql table based on ID numbers associated with that data. The data needs to be inserted into a specific column where id number in the record equals 'IDNum'. The data looks like the following:

ID Number Data
1 piece of data
2 piece of data2
3 piece of data3

Can anyone help?

vijayisonly
Master Smack Fu Yak Hacker

1836 Posts

Posted - 2009-03-06 : 09:17:56
Can you provide some more information..."where id number in the record equals 'IDNum'"...does this mean the value in the column is 'IDNum' or is there another column called IDNum which has to match with the id number that we have in the sample data?

Please post your expected output as well.
Go to Top of Page

sfjtraps
Yak Posting Veteran

65 Posts

Posted - 2009-03-06 : 09:38:26
My apology,

To be more clear, I want to insert data into a sql table column called 'data' where the ID number (there is a column called IDNum) associated with that data is a number 1.

Hopefully this makes more sense, I think I may have over-complicated my first entry.
Go to Top of Page

vijayisonly
Master Smack Fu Yak Hacker

1836 Posts

Posted - 2009-03-06 : 09:51:57
Ok...sounds like what you need is an update..

UPDATE yourtable
SET Data = 'whatever you want to update'
WHERE IDNum = 1
Go to Top of Page
   

- Advertisement -