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 |
|
zaidqis
Yak Posting Veteran
63 Posts |
Posted - 2006-05-29 : 13:10:56
|
hi alli have a question about ifi have this codedeclare @x NUMBERset @x=valueIF @x>1 someconditionSELECT some dataELSESELECT some dataDECLARE @TimeSheetDate DATETIMESET @TimeSheetDate = GETDATE() i want DECLARE @TimeSheetDate DATETIMESET @TimeSheetDate = GETDATE() be executed with no considering if @x>1 or notnote : i am new with t-sqlthank you |
|
|
Srinika
Master Smack Fu Yak Hacker
1378 Posts |
Posted - 2006-05-29 : 14:06:31
|
zaidqis,U may need to learn a lot of things 1. there is no data type as Number (check for the available data types)2. "IF @x>1 somecondition" doesn't make any sense as "@x>1" is a condition itself3. ur concern is about doing something independent of if-else that will be done in the way u wrote it (but its not a good practice)4. Any block of code that u want to execute if a condition is satisfied, has to be put inside a begin-End block. eg. if <Condition> begin <Code> <Code> <Code> .... end else begin <Code> <Code> <Code> .... end Srinika |
 |
|
|
zaidqis
Yak Posting Veteran
63 Posts |
Posted - 2006-05-29 : 15:17:41
|
thank you very much for answe mei am stil beginner with t-sqland i will work hard to be professional with t-sql oneday thank you again for anser me |
 |
|
|
afrika
Master Smack Fu Yak Hacker
2706 Posts |
Posted - 2006-05-29 : 16:37:07
|
| Advice: press the F1 Key to see help files (books online) |
 |
|
|
|
|
|