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.
| Author |
Topic |
|
fuzzyjon
Starting Member
15 Posts |
Posted - 2008-01-10 : 07:30:46
|
| Hello AllI am using the following statement to insert some records but I am getting syntax errors:-INSERT INTO organisation_links (organisation_number_1, organisation_number_2, relationship, amended_on, amended_by)VALUES (105, 19219, 'BRAN', '01/12/2007', 'Jon')WHERE select from organisations where organisation_number_1 IN (105, 124, 125, 265)What I am trying to achieve is this:-Organisation_number_2 is always 19219Organisation_number_1 varies (e.g. 105, 124, 125, 265 etc).So, I am trying to say add the value of 'BRAN' to all the Organisation_number_1 valuesI can see why there is a problem (i.e. I am specifying 1 value for Organisation_number_1 in line 3) and then trying to do my select further down on multiple values - BUT, I don't know how to rectify it!Ant help would be much appreciated.Thanks,Jon |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-01-10 : 07:43:21
|
| TryINSERT INTO organisation_links (organisation_number_1, organisation_number_2, relationship, amended_on, amended_by)select organisation_number_1,19219, 'BRAN', '01/12/2007', 'Jon' from organisationsMadhivananFailing to plan is Planning to fail |
 |
|
|
fuzzyjon
Starting Member
15 Posts |
Posted - 2008-01-10 : 08:21:51
|
| Thanks.... that worked fine!Jon |
 |
|
|
|
|
|
|
|