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 |
|
asafg
Starting Member
39 Posts |
Posted - 2008-09-24 : 03:54:27
|
This is the first time I'm working with TSQL therefor my question is very basicI saw that there are two types of syntax to declare a local variable:1. With AS2. Without ASBoth work! Is there any difference of performence or something else between the two? DECLARE @TestNow AS DATETIMEset @TestNow=getdate()print @TestNow andDECLARE @TestNow DATETIMEset @TestNow=getdate()print @TestNow |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-09-24 : 03:56:33
|
quote: Originally posted by asafg This is the first time I'm working with TSQL therefor my question is very basicI saw that there are two types of syntax to declare a local variable:1. With AS2. Without ASBoth work! Is there any difference of performence or something else between the two? DECLARE @TestNow AS DATETIMEset @TestNow=getdate()print @TestNow andDECLARE @TestNow DATETIMEset @TestNow=getdate()print @TestNow
both the statement batches are same. AS is just an optional keyword which can be used with DECLARE to specify datatype. Even if you not use it its not a problem. |
 |
|
|
asafg
Starting Member
39 Posts |
Posted - 2008-09-24 : 06:44:38
|
| First, thank you.I saw there is no visible difference, I just wanted to be sureThanksAsaf |
 |
|
|
|
|
|