February 24, 2011 at 12:20 pm
I noticed that sql is case sensitive..
I had a table dbo.alrt
when i queried select * from alrt
i got error: invalid object name
then i queried select * from dbo.alrt
then also same error
Then i query : select * from dbo.ALRT
and then I could see the errors..
Isn't sql case insensitive?
Or am I wrong?
Regards,
Sushant
Regards
Sushant Kumar
MCTS,MCP
February 24, 2011 at 12:35 pm
it depends on the collation of the database you are connecting to.
if you create a database with a case sensitive collation, all the tables and objects are going to require that extra level of care, since [Invoice] is not the same as [invoice]
CREATE DATABASE [SandBoxCS] ON PRIMARY
( NAME = N'SandBoxCS', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA\SandBox CS.mdf' , SIZE = 2048KB , FILEGROWTH = 1024KB )
LOG ON
( NAME = N'SandBoxCS_log', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA\SandBox CS_log.ldf' , SIZE = 1024KB , FILEGROWTH = 10%)
COLLATE SQL_Latin1_General_CP1_CS_AS
GO
USE SandBoxCS
GO
SELECT * FROM SYS.COLUMNS --fails
select * from sys.columns --works
Lowell
February 24, 2011 at 12:54 pm
Lowell (2/24/2011)
it depends on the collation of the database you are connecting to.if you create a database with a case sensitive collation, all the tables and objects are going to require that extra level of care, since [Invoice] is not the same as [invoice]
CREATE DATABASE [SandBoxCS] ON PRIMARY
( NAME = N'SandBoxCS', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA\SandBox CS.mdf' , SIZE = 2048KB , FILEGROWTH = 1024KB )
LOG ON
( NAME = N'SandBoxCS_log', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA\SandBox CS_log.ldf' , SIZE = 1024KB , FILEGROWTH = 10%)
COLLATE SQL_Latin1_General_CP1_CS_AS
GO
USE SandBoxCS
GO
SELECT * FROM SYS.COLUMNS --fails
select * from sys.columns --works
The collation of my database is sql_latin1_general_cp850_bin
Regards,
Sushant
Regards
Sushant Kumar
MCTS,MCP
February 24, 2011 at 1:11 pm
The collation of my database is sql_latin1_general_cp850_bin
is a binary collation, so yes, that is case sensitive;
unless you know it's a mistake, the collation must have been put in place for a reason...it's not a sharepoint database or anything, is it? i thought sharepoint db's were usually Latin1_General_CI_AS_KS_WS,
Lowell
February 24, 2011 at 1:17 pm
No, its not a sharepoint database.
Regards,
Sushant
Regards
Sushant Kumar
MCTS,MCP
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply