~~~ .NET Ed ~~~
3/31/2007 10:21:00 AM
When I was into Oracle I used to be able to do things like "SELECT column
INTO varname" and then use that variable into subsequent operations. I need
to do something like that in SQL Server 2005 (Express).
I have a table A with a PK and and several other columns. I am interested in
a non-PK column, say COL_B based on a PK and then use that value to select
on other tables. Something like this:
SELECT col_b INTO var FROM tbl_a WHERE pk_col = 12345
SELECT * FROM tbl_b WHERE col_m = @var
well you get the idea, is there a way to do that?