473,385 Members | 1,720 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Giving values to multible Varibles with SET and SELECT

Hi my problem is real simple. I want to give 2 Varibles values from one SELECT query

Here a exampel.

Expand|Select|Wrap|Line Numbers
  1. DECLARE @test1 int , @test2 int;
  2.  
  3. SET @test1=SELECT a FROM Table_T
  4. SET @test2=SELECT b FROM Table_T
I dont want to use 2 diffrent selects is there any way to do something like this
Expand|Select|Wrap|Line Numbers
  1. DECLARE @test1 int , @test2 int;
  2.  
  3. SET @test1 , @test2=SELECT a , b FROM Table_T
  4.  
  5.  
The , doesn't work but you get the idea.
Jan 23 '07 #1
2 1070
iburyak
1,017 Expert 512MB
Try this:

[PHP]

DECLARE @test1 int , @test2 int;

SELECT @test1 = a, @test2 = b FROM Table_T[/PHP]
Jan 23 '07 #2
Thanks.. Worked perfekt.
Jan 23 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

10
by: Lakshmi Narayanan.R | last post by:
Hi Experts, Using keyword "To" in select case giving error.The following code is got from www.microsrosoft.com itself. What is the wrong with this?. <% Dim Number1 Number1 = 7 ' Initialize...
5
by: clusardi2k | last post by:
Hello, I have a assignment just thrown onto my desk. What is the easiest way to solve it? Below is a brief description of the task. There are multible programs which use the same library...
2
by: rong.guo | last post by:
Hi Group! I am struggling with a problem of giving a date range given the start date. Here is my example, I would need to get all the accounts opened between each month end and the first 5...
4
by: adolph | last post by:
I created 2 tables, each with an autonumber primary key. Fields are: ID (autonumber Primary key) Number (single) Color (Text) FName (text)in one table and LName (text)in the other What I'm...
3
by: sparks | last post by:
I have read in a bunch of files and saved the filename in the table along with the idnumbers and names. Thing is they sent us some files that have to be changed now figures LOL in the...
5
by: ddhung | last post by:
how to insert multible values by making one selection from combo box in forms. any way to code insert SQL in froms??
1
by: Christopher Lusardi | last post by:
How can I prevent multible people, who use my program at the exact same time, from overwritting textfiles? E.G.: Two users start the same program and one deletes something but the other saves his...
2
by: adamace5o | last post by:
When i try to use post variables with php and mysql i can't get the insert into statement to accept varibles as values. If i use 'test' instead of $test it does work. I suspect it is something to do...
2
by: 7arame | last post by:
i want to know how we can write programe add,sub,divid,multible the matrix in c++,,,,,,, and if u can give to me the code i will be thanxfull for u......
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.