Hi, I have a question regarding how to insert one column values into a table by selecting from different table..Here is the syntax..
----
insert into propertytable values (select lastvalue+incrementby from agilesequences where name='SEQPROPERTYTABLE', 13926, 0, 4, 1, 451, 1, 8, 1)
the first column in the propertytable will be... select lastvalue+incrementby from agilesequences where name='SEQPROPERTYTABLE'
How do I do that..Help PLZ..There are probably a number of ways to accomplish this...my preference would be to use a local variable to hold the value.
declare @.seq varchar(20); --[whatever...could be int]
select @.seq = lastvalue+incrementby
from agilesequences
where name='SEQPROPERTYTABLE';
insert into propertytable values (@.seq, 13926, 0, 4, 1, 451, 1, 8, 1);
--------
This should work unless I fat-fingered something.
There may be a way to do this in one pop...
--------|||INSERT INTO propertytable(ColName)
SELECT lastvalue+incrementby
FROM agilesequences
WHERE name='SEQPROPERTYTABLE'
What's this?
13926, 0, 4, 1, 451, 1, 8, 1
And You should supply a collist for the inserted tables...
Damn another fluff reply...|||There are probably a number of ways to accomplish this...my preference would be to use a local variable to hold the value.
declare @.seq varchar(20); --[whatever...could be int]
select @.seq = lastvalue+incrementby
from agilesequences
where name='SEQPROPERTYTABLE';
insert into propertytable values (@.seq, 13926, 0, 4, 1, 451, 1, 8, 1);
--------
This should work unless I fat-fingered something.
There may be a way to do this in one pop...
--------
Thanks a lot guys..
This worked for me.
Wednesday, March 7, 2012
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment