I have a db - DB1 = Collation=SQL_Latin1_General_CP1_CI_AS, SQLSortOrder=52
It's sitting on a server Collation = Latin1_General_BIN
The tempdb = Latin1_General_BIN
Note: I created the db from scratch on the server
When I run the following
CREATE PROCEDURE test
AS
DECALRE @.test VARCHAR(1)
SELECT @.TEST
Error = Server: Msg 137, Level 15, State 2, Procedure test, Line 5
Must declare the variable '@.TEST'.
If I change the SELECT @.TEST to SELECT @.test it works fine.
It looks like it's a case issue , I thought the the db setting overrides the
the server setting and that any new objects created inherited the db
collation levels ?Hi Jack
In the Collate topic in BOL it says "The identifiers for variables, GOTO
labels, temporary stored procedures, and temporary tables are in the default
collation of the instance." Therefore the behaviour you see is as expected.
John
"Jack Vamvas" wrote:
> I have a db - DB1 = Collation=SQL_Latin1_General_CP1_CI_AS, SQLSortOrder=52
> It's sitting on a server Collation = Latin1_General_BIN
> The tempdb = Latin1_General_BIN
> Note: I created the db from scratch on the server
> When I run the following
> CREATE PROCEDURE test
> AS
> DECALRE @.test VARCHAR(1)
> SELECT @.TEST
> Error = Server: Msg 137, Level 15, State 2, Procedure test, Line 5
> Must declare the variable '@.TEST'.
>
> If I change the SELECT @.TEST to SELECT @.test it works fine.
>
> It looks like it's a case issue , I thought the the db setting overrides the
> the server setting and that any new objects created inherited the db
> collation levels ?
>
>
>
>|||Thanks
I've tried all sorts of things , as outlined below, so potentially it look
like the only solution is to either change the COLLATION level of the
instance or make the variables uniform in the sp.
"John Bell" <jbellnewsposts@.hotmail.com> wrote in message
news:AD1B6D99-C104-4F56-BCF8-4E87193FEF82@.microsoft.com...
> Hi Jack
> In the Collate topic in BOL it says "The identifiers for variables, GOTO
> labels, temporary stored procedures, and temporary tables are in the
> default
> collation of the instance." Therefore the behaviour you see is as
> expected.
> John
> "Jack Vamvas" wrote:
>> I have a db - DB1 = Collation=SQL_Latin1_General_CP1_CI_AS,
>> SQLSortOrder=52
>> It's sitting on a server Collation = Latin1_General_BIN
>> The tempdb = Latin1_General_BIN
>> Note: I created the db from scratch on the server
>> When I run the following
>> CREATE PROCEDURE test
>> AS
>> DECALRE @.test VARCHAR(1)
>> SELECT @.TEST
>> Error = Server: Msg 137, Level 15, State 2, Procedure test, Line 5
>> Must declare the variable '@.TEST'.
>>
>> If I change the SELECT @.TEST to SELECT @.test it works fine.
>>
>> It looks like it's a case issue , I thought the the db setting overrides
>> the
>> the server setting and that any new objects created inherited the db
>> collation levels ?
>>
>>
>>|||Hi
Yes, as your instance is case sensitive then the variables will be as well.
As this is a compile error it is not so bad, and it is something you will
need to do if you don't have control of the live environment (e.g. if you
sell a product). Make sure that your coding standards cover this. If you use
source code control (at object level) it will help you track down when issues
due to collation problems are intorduced, and an automated build process
would also be a way of quickly catching this type of error (before you are
rushing to ship a release!)
HTH
John
"Jack Vamvas" wrote:
> Thanks
> I've tried all sorts of things , as outlined below, so potentially it look
> like the only solution is to either change the COLLATION level of the
> instance or make the variables uniform in the sp.
>
> "John Bell" <jbellnewsposts@.hotmail.com> wrote in message
> news:AD1B6D99-C104-4F56-BCF8-4E87193FEF82@.microsoft.com...
> > Hi Jack
> >
> > In the Collate topic in BOL it says "The identifiers for variables, GOTO
> > labels, temporary stored procedures, and temporary tables are in the
> > default
> > collation of the instance." Therefore the behaviour you see is as
> > expected.
> >
> > John
> >
> > "Jack Vamvas" wrote:
> >
> >> I have a db - DB1 = Collation=SQL_Latin1_General_CP1_CI_AS,
> >> SQLSortOrder=52
> >> It's sitting on a server Collation = Latin1_General_BIN
> >> The tempdb = Latin1_General_BIN
> >>
> >> Note: I created the db from scratch on the server
> >>
> >> When I run the following
> >>
> >> CREATE PROCEDURE test
> >> AS
> >> DECALRE @.test VARCHAR(1)
> >> SELECT @.TEST
> >>
> >> Error = Server: Msg 137, Level 15, State 2, Procedure test, Line 5
> >> Must declare the variable '@.TEST'.
> >>
> >>
> >> If I change the SELECT @.TEST to SELECT @.test it works fine.
> >>
> >>
> >> It looks like it's a case issue , I thought the the db setting overrides
> >> the
> >> the server setting and that any new objects created inherited the db
> >> collation levels ?
> >>
> >>
> >>
> >>
> >>
> >>
> >>
>
>sql
Showing posts with label sitting. Show all posts
Showing posts with label sitting. Show all posts
Sunday, March 25, 2012
case sensitive collation issues
I have a db - DB1 = Collation=SQL_Latin1_General_CP1_CI_AS, SQLSortOrder=52
It's sitting on a server Collation = Latin1_General_BIN
The tempdb = Latin1_General_BIN
Note: I created the db from scratch on the server
When I run the following
CREATE PROCEDURE test
AS
DECALRE @.test VARCHAR(1)
SELECT @.TEST
Error = Server: Msg 137, Level 15, State 2, Procedure test, Line 5
Must declare the variable '@.TEST'.
If I change the SELECT @.TEST to SELECT @.test it works fine.
It looks like it's a case issue , I thought the the db setting overrides the
the server setting and that any new objects created inherited the db
collation levels ?did you spell declare incorrectly? However when I spell it correctly and run
your code, it works. Is your code sample complete?
--
Hilary Cotter
Director of Text Mining and Database Strategy
RelevantNOISE.Com - Dedicated to mining blogs for business intelligence.
This posting is my own and doesn't necessarily represent RelevantNoise's
positions, strategies or opinions.
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com
"Jack Vamvas" <DEL_TO_REPLYtechsupport@.ciquery.com> wrote in message
news:rt2dnVE7BcPWIqXYnZ2dnUVZ8qWdnZ2d@.bt.com...
>I have a db - DB1 = Collation=SQL_Latin1_General_CP1_CI_AS,
>SQLSortOrder=52
> It's sitting on a server Collation = Latin1_General_BIN
> The tempdb = Latin1_General_BIN
> Note: I created the db from scratch on the server
> When I run the following
> CREATE PROCEDURE test
> AS
> DECALRE @.test VARCHAR(1)
> SELECT @.TEST
> Error = Server: Msg 137, Level 15, State 2, Procedure test, Line 5
> Must declare the variable '@.TEST'.
>
> If I change the SELECT @.TEST to SELECT @.test it works fine.
>
> It looks like it's a case issue , I thought the the db setting overrides
> the
> the server setting and that any new objects created inherited the db
> collation levels ?
>
>
>
>|||Sorry,Yes , in the db the spelling is correct.
I have run the same code on another server where the server collation and
the db collation are the same , it works fine.
It's in the set up outlined below where the problem arises.
Does the tempdb collation create an issue?
"Hilary Cotter" <hilary.cotter@.gmail.com> wrote in message
news:O6zX7aE9GHA.1188@.TK2MSFTNGP05.phx.gbl...
> did you spell declare incorrectly? However when I spell it correctly and
> run your code, it works. Is your code sample complete?
> --
> Hilary Cotter
> Director of Text Mining and Database Strategy
> RelevantNOISE.Com - Dedicated to mining blogs for business intelligence.
> This posting is my own and doesn't necessarily represent RelevantNoise's
> positions, strategies or opinions.
> Looking for a SQL Server replication book?
> http://www.nwsu.com/0974973602.html
> Looking for a FAQ on Indexing Services/SQL FTS
> http://www.indexserverfaq.com
>
> "Jack Vamvas" <DEL_TO_REPLYtechsupport@.ciquery.com> wrote in message
> news:rt2dnVE7BcPWIqXYnZ2dnUVZ8qWdnZ2d@.bt.com...
>>I have a db - DB1 = Collation=SQL_Latin1_General_CP1_CI_AS,
>>SQLSortOrder=52
>> It's sitting on a server Collation = Latin1_General_BIN
>> The tempdb = Latin1_General_BIN
>> Note: I created the db from scratch on the server
>> When I run the following
>> CREATE PROCEDURE test
>> AS
>> DECALRE @.test VARCHAR(1)
>> SELECT @.TEST
>> Error = Server: Msg 137, Level 15, State 2, Procedure test, Line 5
>> Must declare the variable '@.TEST'.
>>
>> If I change the SELECT @.TEST to SELECT @.test it works fine.
>>
>> It looks like it's a case issue , I thought the the db setting overrides
>> the
>> the server setting and that any new objects created inherited the db
>> collation levels ?
>>
>>
>>
>|||Hi Jack
With tempdb using a different collation then you may have collation
conflicts when creating or joining to temporary tables. This can be overcome
by using the COLLATE option to force the collation when you either join to
the temporary table or when it is created.
John
"Jack Vamvas" wrote:
> Sorry,Yes , in the db the spelling is correct.
> I have run the same code on another server where the server collation and
> the db collation are the same , it works fine.
> It's in the set up outlined below where the problem arises.
> Does the tempdb collation create an issue?
>
> "Hilary Cotter" <hilary.cotter@.gmail.com> wrote in message
> news:O6zX7aE9GHA.1188@.TK2MSFTNGP05.phx.gbl...
> > did you spell declare incorrectly? However when I spell it correctly and
> > run your code, it works. Is your code sample complete?
> >
> > --
> > Hilary Cotter
> > Director of Text Mining and Database Strategy
> > RelevantNOISE.Com - Dedicated to mining blogs for business intelligence.
> >
> > This posting is my own and doesn't necessarily represent RelevantNoise's
> > positions, strategies or opinions.
> >
> > Looking for a SQL Server replication book?
> > http://www.nwsu.com/0974973602.html
> >
> > Looking for a FAQ on Indexing Services/SQL FTS
> > http://www.indexserverfaq.com
> >
> >
> >
> > "Jack Vamvas" <DEL_TO_REPLYtechsupport@.ciquery.com> wrote in message
> > news:rt2dnVE7BcPWIqXYnZ2dnUVZ8qWdnZ2d@.bt.com...
> >>I have a db - DB1 = Collation=SQL_Latin1_General_CP1_CI_AS,
> >>SQLSortOrder=52
> >> It's sitting on a server Collation = Latin1_General_BIN
> >> The tempdb = Latin1_General_BIN
> >>
> >> Note: I created the db from scratch on the server
> >>
> >> When I run the following
> >>
> >> CREATE PROCEDURE test
> >> AS
> >> DECALRE @.test VARCHAR(1)
> >> SELECT @.TEST
> >>
> >> Error = Server: Msg 137, Level 15, State 2, Procedure test, Line 5
> >> Must declare the variable '@.TEST'.
> >>
> >>
> >> If I change the SELECT @.TEST to SELECT @.test it works fine.
> >>
> >>
> >> It looks like it's a case issue , I thought the the db setting overrides
> >> the
> >> the server setting and that any new objects created inherited the db
> >> collation levels ?
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >
> >
>
>
It's sitting on a server Collation = Latin1_General_BIN
The tempdb = Latin1_General_BIN
Note: I created the db from scratch on the server
When I run the following
CREATE PROCEDURE test
AS
DECALRE @.test VARCHAR(1)
SELECT @.TEST
Error = Server: Msg 137, Level 15, State 2, Procedure test, Line 5
Must declare the variable '@.TEST'.
If I change the SELECT @.TEST to SELECT @.test it works fine.
It looks like it's a case issue , I thought the the db setting overrides the
the server setting and that any new objects created inherited the db
collation levels ?did you spell declare incorrectly? However when I spell it correctly and run
your code, it works. Is your code sample complete?
--
Hilary Cotter
Director of Text Mining and Database Strategy
RelevantNOISE.Com - Dedicated to mining blogs for business intelligence.
This posting is my own and doesn't necessarily represent RelevantNoise's
positions, strategies or opinions.
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com
"Jack Vamvas" <DEL_TO_REPLYtechsupport@.ciquery.com> wrote in message
news:rt2dnVE7BcPWIqXYnZ2dnUVZ8qWdnZ2d@.bt.com...
>I have a db - DB1 = Collation=SQL_Latin1_General_CP1_CI_AS,
>SQLSortOrder=52
> It's sitting on a server Collation = Latin1_General_BIN
> The tempdb = Latin1_General_BIN
> Note: I created the db from scratch on the server
> When I run the following
> CREATE PROCEDURE test
> AS
> DECALRE @.test VARCHAR(1)
> SELECT @.TEST
> Error = Server: Msg 137, Level 15, State 2, Procedure test, Line 5
> Must declare the variable '@.TEST'.
>
> If I change the SELECT @.TEST to SELECT @.test it works fine.
>
> It looks like it's a case issue , I thought the the db setting overrides
> the
> the server setting and that any new objects created inherited the db
> collation levels ?
>
>
>
>|||Sorry,Yes , in the db the spelling is correct.
I have run the same code on another server where the server collation and
the db collation are the same , it works fine.
It's in the set up outlined below where the problem arises.
Does the tempdb collation create an issue?
"Hilary Cotter" <hilary.cotter@.gmail.com> wrote in message
news:O6zX7aE9GHA.1188@.TK2MSFTNGP05.phx.gbl...
> did you spell declare incorrectly? However when I spell it correctly and
> run your code, it works. Is your code sample complete?
> --
> Hilary Cotter
> Director of Text Mining and Database Strategy
> RelevantNOISE.Com - Dedicated to mining blogs for business intelligence.
> This posting is my own and doesn't necessarily represent RelevantNoise's
> positions, strategies or opinions.
> Looking for a SQL Server replication book?
> http://www.nwsu.com/0974973602.html
> Looking for a FAQ on Indexing Services/SQL FTS
> http://www.indexserverfaq.com
>
> "Jack Vamvas" <DEL_TO_REPLYtechsupport@.ciquery.com> wrote in message
> news:rt2dnVE7BcPWIqXYnZ2dnUVZ8qWdnZ2d@.bt.com...
>>I have a db - DB1 = Collation=SQL_Latin1_General_CP1_CI_AS,
>>SQLSortOrder=52
>> It's sitting on a server Collation = Latin1_General_BIN
>> The tempdb = Latin1_General_BIN
>> Note: I created the db from scratch on the server
>> When I run the following
>> CREATE PROCEDURE test
>> AS
>> DECALRE @.test VARCHAR(1)
>> SELECT @.TEST
>> Error = Server: Msg 137, Level 15, State 2, Procedure test, Line 5
>> Must declare the variable '@.TEST'.
>>
>> If I change the SELECT @.TEST to SELECT @.test it works fine.
>>
>> It looks like it's a case issue , I thought the the db setting overrides
>> the
>> the server setting and that any new objects created inherited the db
>> collation levels ?
>>
>>
>>
>|||Hi Jack
With tempdb using a different collation then you may have collation
conflicts when creating or joining to temporary tables. This can be overcome
by using the COLLATE option to force the collation when you either join to
the temporary table or when it is created.
John
"Jack Vamvas" wrote:
> Sorry,Yes , in the db the spelling is correct.
> I have run the same code on another server where the server collation and
> the db collation are the same , it works fine.
> It's in the set up outlined below where the problem arises.
> Does the tempdb collation create an issue?
>
> "Hilary Cotter" <hilary.cotter@.gmail.com> wrote in message
> news:O6zX7aE9GHA.1188@.TK2MSFTNGP05.phx.gbl...
> > did you spell declare incorrectly? However when I spell it correctly and
> > run your code, it works. Is your code sample complete?
> >
> > --
> > Hilary Cotter
> > Director of Text Mining and Database Strategy
> > RelevantNOISE.Com - Dedicated to mining blogs for business intelligence.
> >
> > This posting is my own and doesn't necessarily represent RelevantNoise's
> > positions, strategies or opinions.
> >
> > Looking for a SQL Server replication book?
> > http://www.nwsu.com/0974973602.html
> >
> > Looking for a FAQ on Indexing Services/SQL FTS
> > http://www.indexserverfaq.com
> >
> >
> >
> > "Jack Vamvas" <DEL_TO_REPLYtechsupport@.ciquery.com> wrote in message
> > news:rt2dnVE7BcPWIqXYnZ2dnUVZ8qWdnZ2d@.bt.com...
> >>I have a db - DB1 = Collation=SQL_Latin1_General_CP1_CI_AS,
> >>SQLSortOrder=52
> >> It's sitting on a server Collation = Latin1_General_BIN
> >> The tempdb = Latin1_General_BIN
> >>
> >> Note: I created the db from scratch on the server
> >>
> >> When I run the following
> >>
> >> CREATE PROCEDURE test
> >> AS
> >> DECALRE @.test VARCHAR(1)
> >> SELECT @.TEST
> >>
> >> Error = Server: Msg 137, Level 15, State 2, Procedure test, Line 5
> >> Must declare the variable '@.TEST'.
> >>
> >>
> >> If I change the SELECT @.TEST to SELECT @.test it works fine.
> >>
> >>
> >> It looks like it's a case issue , I thought the the db setting overrides
> >> the
> >> the server setting and that any new objects created inherited the db
> >> collation levels ?
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >
> >
>
>
Labels:
case,
collation,
collationsql_latin1_general_cp1_ci_as,
database,
db1,
latin1_general_bin,
microsoft,
mysql,
oracle,
sensitive,
server,
sitting,
sql,
sqlsortorder52,
tempdb
case sensitive collation issues
I have a db - DB1 = Collation=SQL_Latin1_General_CP1_CI_AS, SQLSortOrder=52
It's sitting on a server Collation = Latin1_General_BIN
The tempdb = Latin1_General_BIN
Note: I created the db from scratch on the server
When I run the following
CREATE PROCEDURE test
AS
DECALRE @.test VARCHAR(1)
SELECT @.TEST
Error = Server: Msg 137, Level 15, State 2, Procedure test, Line 5
Must declare the variable '@.TEST'.
If I change the SELECT @.TEST to SELECT @.test it works fine.
It looks like it's a case issue , I thought the the db setting overrides the
the server setting and that any new objects created inherited the db
collation levels ?
did you spell declare incorrectly? However when I spell it correctly and run
your code, it works. Is your code sample complete?
Hilary Cotter
Director of Text Mining and Database Strategy
RelevantNOISE.Com - Dedicated to mining blogs for business intelligence.
This posting is my own and doesn't necessarily represent RelevantNoise's
positions, strategies or opinions.
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com
"Jack Vamvas" <DEL_TO_REPLYtechsupport@.ciquery.com> wrote in message
news:rt2dnVE7BcPWIqXYnZ2dnUVZ8qWdnZ2d@.bt.com...
>I have a db - DB1 = Collation=SQL_Latin1_General_CP1_CI_AS,
>SQLSortOrder=52
> It's sitting on a server Collation = Latin1_General_BIN
> The tempdb = Latin1_General_BIN
> Note: I created the db from scratch on the server
> When I run the following
> CREATE PROCEDURE test
> AS
> DECALRE @.test VARCHAR(1)
> SELECT @.TEST
> Error = Server: Msg 137, Level 15, State 2, Procedure test, Line 5
> Must declare the variable '@.TEST'.
>
> If I change the SELECT @.TEST to SELECT @.test it works fine.
>
> It looks like it's a case issue , I thought the the db setting overrides
> the
> the server setting and that any new objects created inherited the db
> collation levels ?
>
>
>
>
|||Sorry,Yes , in the db the spelling is correct.
I have run the same code on another server where the server collation and
the db collation are the same , it works fine.
It's in the set up outlined below where the problem arises.
Does the tempdb collation create an issue?
"Hilary Cotter" <hilary.cotter@.gmail.com> wrote in message
news:O6zX7aE9GHA.1188@.TK2MSFTNGP05.phx.gbl...
> did you spell declare incorrectly? However when I spell it correctly and
> run your code, it works. Is your code sample complete?
> --
> Hilary Cotter
> Director of Text Mining and Database Strategy
> RelevantNOISE.Com - Dedicated to mining blogs for business intelligence.
> This posting is my own and doesn't necessarily represent RelevantNoise's
> positions, strategies or opinions.
> Looking for a SQL Server replication book?
> http://www.nwsu.com/0974973602.html
> Looking for a FAQ on Indexing Services/SQL FTS
> http://www.indexserverfaq.com
>
> "Jack Vamvas" <DEL_TO_REPLYtechsupport@.ciquery.com> wrote in message
> news:rt2dnVE7BcPWIqXYnZ2dnUVZ8qWdnZ2d@.bt.com...
>
|||Hi Jack
With tempdb using a different collation then you may have collation
conflicts when creating or joining to temporary tables. This can be overcome
by using the COLLATE option to force the collation when you either join to
the temporary table or when it is created.
John
"Jack Vamvas" wrote:
> Sorry,Yes , in the db the spelling is correct.
> I have run the same code on another server where the server collation and
> the db collation are the same , it works fine.
> It's in the set up outlined below where the problem arises.
> Does the tempdb collation create an issue?
>
> "Hilary Cotter" <hilary.cotter@.gmail.com> wrote in message
> news:O6zX7aE9GHA.1188@.TK2MSFTNGP05.phx.gbl...
>
>
It's sitting on a server Collation = Latin1_General_BIN
The tempdb = Latin1_General_BIN
Note: I created the db from scratch on the server
When I run the following
CREATE PROCEDURE test
AS
DECALRE @.test VARCHAR(1)
SELECT @.TEST
Error = Server: Msg 137, Level 15, State 2, Procedure test, Line 5
Must declare the variable '@.TEST'.
If I change the SELECT @.TEST to SELECT @.test it works fine.
It looks like it's a case issue , I thought the the db setting overrides the
the server setting and that any new objects created inherited the db
collation levels ?
did you spell declare incorrectly? However when I spell it correctly and run
your code, it works. Is your code sample complete?
Hilary Cotter
Director of Text Mining and Database Strategy
RelevantNOISE.Com - Dedicated to mining blogs for business intelligence.
This posting is my own and doesn't necessarily represent RelevantNoise's
positions, strategies or opinions.
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com
"Jack Vamvas" <DEL_TO_REPLYtechsupport@.ciquery.com> wrote in message
news:rt2dnVE7BcPWIqXYnZ2dnUVZ8qWdnZ2d@.bt.com...
>I have a db - DB1 = Collation=SQL_Latin1_General_CP1_CI_AS,
>SQLSortOrder=52
> It's sitting on a server Collation = Latin1_General_BIN
> The tempdb = Latin1_General_BIN
> Note: I created the db from scratch on the server
> When I run the following
> CREATE PROCEDURE test
> AS
> DECALRE @.test VARCHAR(1)
> SELECT @.TEST
> Error = Server: Msg 137, Level 15, State 2, Procedure test, Line 5
> Must declare the variable '@.TEST'.
>
> If I change the SELECT @.TEST to SELECT @.test it works fine.
>
> It looks like it's a case issue , I thought the the db setting overrides
> the
> the server setting and that any new objects created inherited the db
> collation levels ?
>
>
>
>
|||Sorry,Yes , in the db the spelling is correct.
I have run the same code on another server where the server collation and
the db collation are the same , it works fine.
It's in the set up outlined below where the problem arises.
Does the tempdb collation create an issue?
"Hilary Cotter" <hilary.cotter@.gmail.com> wrote in message
news:O6zX7aE9GHA.1188@.TK2MSFTNGP05.phx.gbl...
> did you spell declare incorrectly? However when I spell it correctly and
> run your code, it works. Is your code sample complete?
> --
> Hilary Cotter
> Director of Text Mining and Database Strategy
> RelevantNOISE.Com - Dedicated to mining blogs for business intelligence.
> This posting is my own and doesn't necessarily represent RelevantNoise's
> positions, strategies or opinions.
> Looking for a SQL Server replication book?
> http://www.nwsu.com/0974973602.html
> Looking for a FAQ on Indexing Services/SQL FTS
> http://www.indexserverfaq.com
>
> "Jack Vamvas" <DEL_TO_REPLYtechsupport@.ciquery.com> wrote in message
> news:rt2dnVE7BcPWIqXYnZ2dnUVZ8qWdnZ2d@.bt.com...
>
|||Hi Jack
With tempdb using a different collation then you may have collation
conflicts when creating or joining to temporary tables. This can be overcome
by using the COLLATE option to force the collation when you either join to
the temporary table or when it is created.
John
"Jack Vamvas" wrote:
> Sorry,Yes , in the db the spelling is correct.
> I have run the same code on another server where the server collation and
> the db collation are the same , it works fine.
> It's in the set up outlined below where the problem arises.
> Does the tempdb collation create an issue?
>
> "Hilary Cotter" <hilary.cotter@.gmail.com> wrote in message
> news:O6zX7aE9GHA.1188@.TK2MSFTNGP05.phx.gbl...
>
>
Thursday, March 22, 2012
case sensitive collation issues
I have a db - DB1 = Collation=SQL_Latin1_General_CP1_CI_AS, SQLSortOrder=52
It's sitting on a server Collation = Latin1_General_BIN
The tempdb = Latin1_General_BIN
Note: I created the db from scratch on the server
When I run the following
CREATE PROCEDURE test
AS
DECALRE @.test VARCHAR(1)
SELECT @.TEST
Error = Server: Msg 137, Level 15, State 2, Procedure test, Line 5
Must declare the variable '@.TEST'.
If I change the SELECT @.TEST to SELECT @.test it works fine.
It looks like it's a case issue , I thought the the db setting overrides the
the server setting and that any new objects created inherited the db
collation levels ?
Hi Jack
In the Collate topic in BOL it says "The identifiers for variables, GOTO
labels, temporary stored procedures, and temporary tables are in the default
collation of the instance." Therefore the behaviour you see is as expected.
John
"Jack Vamvas" wrote:
> I have a db - DB1 = Collation=SQL_Latin1_General_CP1_CI_AS, SQLSortOrder=52
> It's sitting on a server Collation = Latin1_General_BIN
> The tempdb = Latin1_General_BIN
> Note: I created the db from scratch on the server
> When I run the following
> CREATE PROCEDURE test
> AS
> DECALRE @.test VARCHAR(1)
> SELECT @.TEST
> Error = Server: Msg 137, Level 15, State 2, Procedure test, Line 5
> Must declare the variable '@.TEST'.
>
> If I change the SELECT @.TEST to SELECT @.test it works fine.
>
> It looks like it's a case issue , I thought the the db setting overrides the
> the server setting and that any new objects created inherited the db
> collation levels ?
>
>
>
>
|||Thanks
I've tried all sorts of things , as outlined below, so potentially it look
like the only solution is to either change the COLLATION level of the
instance or make the variables uniform in the sp.
"John Bell" <jbellnewsposts@.hotmail.com> wrote in message
news:AD1B6D99-C104-4F56-BCF8-4E87193FEF82@.microsoft.com...[vbcol=seagreen]
> Hi Jack
> In the Collate topic in BOL it says "The identifiers for variables, GOTO
> labels, temporary stored procedures, and temporary tables are in the
> default
> collation of the instance." Therefore the behaviour you see is as
> expected.
> John
> "Jack Vamvas" wrote:
|||Hi
Yes, as your instance is case sensitive then the variables will be as well.
As this is a compile error it is not so bad, and it is something you will
need to do if you don't have control of the live environment (e.g. if you
sell a product). Make sure that your coding standards cover this. If you use
source code control (at object level) it will help you track down when issues
due to collation problems are intorduced, and an automated build process
would also be a way of quickly catching this type of error (before you are
rushing to ship a release!)
HTH
John
"Jack Vamvas" wrote:
> Thanks
> I've tried all sorts of things , as outlined below, so potentially it look
> like the only solution is to either change the COLLATION level of the
> instance or make the variables uniform in the sp.
>
> "John Bell" <jbellnewsposts@.hotmail.com> wrote in message
> news:AD1B6D99-C104-4F56-BCF8-4E87193FEF82@.microsoft.com...
>
>
It's sitting on a server Collation = Latin1_General_BIN
The tempdb = Latin1_General_BIN
Note: I created the db from scratch on the server
When I run the following
CREATE PROCEDURE test
AS
DECALRE @.test VARCHAR(1)
SELECT @.TEST
Error = Server: Msg 137, Level 15, State 2, Procedure test, Line 5
Must declare the variable '@.TEST'.
If I change the SELECT @.TEST to SELECT @.test it works fine.
It looks like it's a case issue , I thought the the db setting overrides the
the server setting and that any new objects created inherited the db
collation levels ?
Hi Jack
In the Collate topic in BOL it says "The identifiers for variables, GOTO
labels, temporary stored procedures, and temporary tables are in the default
collation of the instance." Therefore the behaviour you see is as expected.
John
"Jack Vamvas" wrote:
> I have a db - DB1 = Collation=SQL_Latin1_General_CP1_CI_AS, SQLSortOrder=52
> It's sitting on a server Collation = Latin1_General_BIN
> The tempdb = Latin1_General_BIN
> Note: I created the db from scratch on the server
> When I run the following
> CREATE PROCEDURE test
> AS
> DECALRE @.test VARCHAR(1)
> SELECT @.TEST
> Error = Server: Msg 137, Level 15, State 2, Procedure test, Line 5
> Must declare the variable '@.TEST'.
>
> If I change the SELECT @.TEST to SELECT @.test it works fine.
>
> It looks like it's a case issue , I thought the the db setting overrides the
> the server setting and that any new objects created inherited the db
> collation levels ?
>
>
>
>
|||Thanks
I've tried all sorts of things , as outlined below, so potentially it look
like the only solution is to either change the COLLATION level of the
instance or make the variables uniform in the sp.
"John Bell" <jbellnewsposts@.hotmail.com> wrote in message
news:AD1B6D99-C104-4F56-BCF8-4E87193FEF82@.microsoft.com...[vbcol=seagreen]
> Hi Jack
> In the Collate topic in BOL it says "The identifiers for variables, GOTO
> labels, temporary stored procedures, and temporary tables are in the
> default
> collation of the instance." Therefore the behaviour you see is as
> expected.
> John
> "Jack Vamvas" wrote:
|||Hi
Yes, as your instance is case sensitive then the variables will be as well.
As this is a compile error it is not so bad, and it is something you will
need to do if you don't have control of the live environment (e.g. if you
sell a product). Make sure that your coding standards cover this. If you use
source code control (at object level) it will help you track down when issues
due to collation problems are intorduced, and an automated build process
would also be a way of quickly catching this type of error (before you are
rushing to ship a release!)
HTH
John
"Jack Vamvas" wrote:
> Thanks
> I've tried all sorts of things , as outlined below, so potentially it look
> like the only solution is to either change the COLLATION level of the
> instance or make the variables uniform in the sp.
>
> "John Bell" <jbellnewsposts@.hotmail.com> wrote in message
> news:AD1B6D99-C104-4F56-BCF8-4E87193FEF82@.microsoft.com...
>
>
case sensitive collation issues
I have a db - DB1 = Collation=SQL_Latin1_General_CP1_CI_AS, SQLSortOrder=52
It's sitting on a server Collation = Latin1_General_BIN
The tempdb = Latin1_General_BIN
Note: I created the db from scratch on the server
When I run the following
CREATE PROCEDURE test
AS
DECALRE @.test VARCHAR(1)
SELECT @.TEST
Error = Server: Msg 137, Level 15, State 2, Procedure test, Line 5
Must declare the variable '@.TEST'.
If I change the SELECT @.TEST to SELECT @.test it works fine.
It looks like it's a case issue , I thought the the db setting overrides the
the server setting and that any new objects created inherited the db
collation levels ?did you spell declare incorrectly? However when I spell it correctly and run
your code, it works. Is your code sample complete?
Hilary Cotter
Director of Text Mining and Database Strategy
RelevantNOISE.Com - Dedicated to mining blogs for business intelligence.
This posting is my own and doesn't necessarily represent RelevantNoise's
positions, strategies or opinions.
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com
"Jack Vamvas" <DEL_TO_REPLYtechsupport@.ciquery.com> wrote in message
news:rt2dnVE7BcPWIqXYnZ2dnUVZ8qWdnZ2d@.bt
.com...
>I have a db - DB1 = Collation=SQL_Latin1_General_CP1_CI_AS,
>SQLSortOrder=52
> It's sitting on a server Collation = Latin1_General_BIN
> The tempdb = Latin1_General_BIN
> Note: I created the db from scratch on the server
> When I run the following
> CREATE PROCEDURE test
> AS
> DECALRE @.test VARCHAR(1)
> SELECT @.TEST
> Error = Server: Msg 137, Level 15, State 2, Procedure test, Line 5
> Must declare the variable '@.TEST'.
>
> If I change the SELECT @.TEST to SELECT @.test it works fine.
>
> It looks like it's a case issue , I thought the the db setting overrides
> the
> the server setting and that any new objects created inherited the db
> collation levels ?
>
>
>
>|||Sorry,Yes , in the db the spelling is correct.
I have run the same code on another server where the server collation and
the db collation are the same , it works fine.
It's in the set up outlined below where the problem arises.
Does the tempdb collation create an issue?
"Hilary Cotter" <hilary.cotter@.gmail.com> wrote in message
news:O6zX7aE9GHA.1188@.TK2MSFTNGP05.phx.gbl...
> did you spell declare incorrectly? However when I spell it correctly and
> run your code, it works. Is your code sample complete?
> --
> Hilary Cotter
> Director of Text Mining and Database Strategy
> RelevantNOISE.Com - Dedicated to mining blogs for business intelligence.
> This posting is my own and doesn't necessarily represent RelevantNoise's
> positions, strategies or opinions.
> Looking for a SQL Server replication book?
> http://www.nwsu.com/0974973602.html
> Looking for a FAQ on Indexing Services/SQL FTS
> http://www.indexserverfaq.com
>
> "Jack Vamvas" <DEL_TO_REPLYtechsupport@.ciquery.com> wrote in message
> news:rt2dnVE7BcPWIqXYnZ2dnUVZ8qWdnZ2d@.bt
.com...
>|||Hi Jack
With tempdb using a different collation then you may have collation
conflicts when creating or joining to temporary tables. This can be overcome
by using the COLLATE option to force the collation when you either join to
the temporary table or when it is created.
John
"Jack Vamvas" wrote:
> Sorry,Yes , in the db the spelling is correct.
> I have run the same code on another server where the server collation and
> the db collation are the same , it works fine.
> It's in the set up outlined below where the problem arises.
> Does the tempdb collation create an issue?
>
> "Hilary Cotter" <hilary.cotter@.gmail.com> wrote in message
> news:O6zX7aE9GHA.1188@.TK2MSFTNGP05.phx.gbl...
>
>
It's sitting on a server Collation = Latin1_General_BIN
The tempdb = Latin1_General_BIN
Note: I created the db from scratch on the server
When I run the following
CREATE PROCEDURE test
AS
DECALRE @.test VARCHAR(1)
SELECT @.TEST
Error = Server: Msg 137, Level 15, State 2, Procedure test, Line 5
Must declare the variable '@.TEST'.
If I change the SELECT @.TEST to SELECT @.test it works fine.
It looks like it's a case issue , I thought the the db setting overrides the
the server setting and that any new objects created inherited the db
collation levels ?did you spell declare incorrectly? However when I spell it correctly and run
your code, it works. Is your code sample complete?
Hilary Cotter
Director of Text Mining and Database Strategy
RelevantNOISE.Com - Dedicated to mining blogs for business intelligence.
This posting is my own and doesn't necessarily represent RelevantNoise's
positions, strategies or opinions.
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com
"Jack Vamvas" <DEL_TO_REPLYtechsupport@.ciquery.com> wrote in message
news:rt2dnVE7BcPWIqXYnZ2dnUVZ8qWdnZ2d@.bt
.com...
>I have a db - DB1 = Collation=SQL_Latin1_General_CP1_CI_AS,
>SQLSortOrder=52
> It's sitting on a server Collation = Latin1_General_BIN
> The tempdb = Latin1_General_BIN
> Note: I created the db from scratch on the server
> When I run the following
> CREATE PROCEDURE test
> AS
> DECALRE @.test VARCHAR(1)
> SELECT @.TEST
> Error = Server: Msg 137, Level 15, State 2, Procedure test, Line 5
> Must declare the variable '@.TEST'.
>
> If I change the SELECT @.TEST to SELECT @.test it works fine.
>
> It looks like it's a case issue , I thought the the db setting overrides
> the
> the server setting and that any new objects created inherited the db
> collation levels ?
>
>
>
>|||Sorry,Yes , in the db the spelling is correct.
I have run the same code on another server where the server collation and
the db collation are the same , it works fine.
It's in the set up outlined below where the problem arises.
Does the tempdb collation create an issue?
"Hilary Cotter" <hilary.cotter@.gmail.com> wrote in message
news:O6zX7aE9GHA.1188@.TK2MSFTNGP05.phx.gbl...
> did you spell declare incorrectly? However when I spell it correctly and
> run your code, it works. Is your code sample complete?
> --
> Hilary Cotter
> Director of Text Mining and Database Strategy
> RelevantNOISE.Com - Dedicated to mining blogs for business intelligence.
> This posting is my own and doesn't necessarily represent RelevantNoise's
> positions, strategies or opinions.
> Looking for a SQL Server replication book?
> http://www.nwsu.com/0974973602.html
> Looking for a FAQ on Indexing Services/SQL FTS
> http://www.indexserverfaq.com
>
> "Jack Vamvas" <DEL_TO_REPLYtechsupport@.ciquery.com> wrote in message
> news:rt2dnVE7BcPWIqXYnZ2dnUVZ8qWdnZ2d@.bt
.com...
>|||Hi Jack
With tempdb using a different collation then you may have collation
conflicts when creating or joining to temporary tables. This can be overcome
by using the COLLATE option to force the collation when you either join to
the temporary table or when it is created.
John
"Jack Vamvas" wrote:
> Sorry,Yes , in the db the spelling is correct.
> I have run the same code on another server where the server collation and
> the db collation are the same , it works fine.
> It's in the set up outlined below where the problem arises.
> Does the tempdb collation create an issue?
>
> "Hilary Cotter" <hilary.cotter@.gmail.com> wrote in message
> news:O6zX7aE9GHA.1188@.TK2MSFTNGP05.phx.gbl...
>
>
Subscribe to:
Posts (Atom)