Tim Hibbard

CEO for EnGraph software
posts - 626, comments - 1586, trackbacks - 459

My Links

News



Add to Google

Twitter












Tag Cloud

Article Categories

Archives

Post Categories

Image Galleries

EnGraph Blogs

Links

Other

Roll

Declaring variables in SQL

I would like to blog more about the problems I encounter on a daily basis.  I find that taking 10 minutes or so to write a simple solution to my problems helps me retain that information.

I always forget the specific syntax to declaring variables in T-SQL. 

declare @startdate datetime;
declare @enddate datetime;
 
set @startdate = '04/01/2010';
set @enddate = '04/30/2010';
 
select count(id) from triphistory where tripdate between @startdate and @enddate

Print | posted on Monday, June 07, 2010 9:46 AM |

Feedback

Gravatar

# re: Declaring variables in SQL

Thanks for writing that out. I end up doing quick google searches for the SQL syntax I need...to have these organized somehow would be great.
Roxanne@stretching routine
8/14/2011 10:30 AM | Roxanne
Post A Comment
Title:
Name:
Email:
Website:
Comment:
Verification:
 
 

Powered by: