views:

650

answers:

3

for example...

ALTER PROCEDURE [dbo].[Reports_Dashboard_Get_Sav]   
    -- Add the parameters for the stored procedure here
    @startDate datetime,
    @endDate datetime,
    @companyID int=null

set @days=datediff(m,@startdate,@enddate)
if (@days)=0 
    set @days=1

This is not my code but if this is case sensitive then @days is not going to be calculated properly as the startDate/startdate and endDate/enddate variables don't match...

+1  A: 

No. Not T-SQL at least...

Shawn Simon
A: 

As I recall, they are not case sensitive for the SQL commands themselves, I've routinely seen them written as lowercase. I'm pretty sure the rest is case-insensitive as well given that its an extension of the T-SQL spec.

Soviut
+10  A: 

They can be, depending on your database's collation. When you install SQL Server and choose your default collation, you'll notice that there's a "case sensitivity" checkbox. Certain collations are case sensitive and will affect your queries (and stored procedures).

Worse still, many vendors don't test their products on servers with case sensitive collations, which leads to runtime errors.

Matt Hamilton
argh you beat me -- here is a link tho http://aspadvice.com/blogs/ssmith/archive/2007/09/30/Case-Sensitive-or-Insensitive-SQL-Query.aspx
dbones
Does that apply to variable names? Or just data?
Michael Haren
I was surprised to find this out when we gained access to another database at work - not only were database objects case sensitive but so were queries against table data.
Russ Cam
But your query won't run if it can't find the objects - it's not just going to silently insert NULLs or anything. Now it might not think a table exists, but in a LEFT JOIN, say, you aren't going to just get NULLs because a table is not in the right case, you'll get an error.
Cade Roux
@Cade, that's true
Russ Cam