Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Case Sensitivity in sp_describe_undeclared_parameters Expand / Collapse
Author
Message
Posted Thursday, July 25, 2013 7:30 AM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: 2 days ago @ 7:42 AM
Points: 229, Visits: 394
We recently upgraded one of our databases to 2012 Compatibility Mode, and are now getting an error from sp_describe_undeclared_parameters when running an SSIS package that one of the parameters isn't valid.

We've tracked it down to the parameter in the command in the package not having the same case as the parameter in the stored procedure. This obviously wasn't an issue prior to 2012, and we've been able to reproduce it with other stored procedures and parameters.

Both the server and database have collations of SQL_Latin1_General_CP1_CI_AS, so I'm not sure where this case sensitivity is coming from...

Anyone run into something similar? Thanks!
Post #1477482
Posted Thursday, July 25, 2013 8:04 AM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Monday, November 3, 2014 8:05 AM
Points: 1,191, Visits: 9,892
That's odd. The collation of both the user and system databases is case-insensitive?

I guess it's possible there were changes around this for contained databases, but system procedures have always followed the case sensitivity rule of the database you're connected to at the time, AFAIK. Does the problem appear/go away when changing the compatibility mode?

Does the following query bring back any databases with a case-sensitive collation?

SELECT DISTINCT collation_name FROM sys.databases

Post #1477508
Posted Thursday, July 25, 2013 8:11 AM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: 2 days ago @ 7:42 AM
Points: 229, Visits: 394
Collation is SQL_Latin1_General_CP1_CI_AS returned from that query...

I suspect it would be easy for anyone to reproduce unless something in our setup is weird.

Here's a quick script...

create proc test @test1 varchar(128) as 
select * from sys.objects where [name] = @test1

exec sp_describe_undeclared_parameters N'exec test @test1 =@P1'
exec sp_describe_undeclared_parameters N'exec test @Test1 =@P1'

exec test @test1 = 'test'
exec test @Test1 = 'test'

The sproc is created fine for me, the first sp_describe_undeclared_parameters runs fine, the second returns the error about the parameter not being valid, and the last two both run successfully.
Post #1477514
Posted Thursday, July 25, 2013 8:32 AM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Monday, November 3, 2014 8:05 AM
Points: 1,191, Visits: 9,892
Ah, I see. sp_describe_undeclared_parameters is a new 2012 proc.

Yes, I get the same result.

So is SSIS 2012 executing this statement as part of it's internal validation routines, or have you added it to your code?

Sounding like a bug to me, it should definitely follow the case sensitivity of the database.
Post #1477528
Posted Thursday, July 25, 2013 8:41 AM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: 2 days ago @ 7:42 AM
Points: 229, Visits: 394
We're using an OLEDB Command task to execute the stored procedure, and I believe that treats it as dynamic SQL and executes that new system sproc as part of validation (we're not doing it explicitly). So this worked fine prior to 2012 obviously, but once we upgrade, it started erroring out when it hit that task.
Post #1477534
Posted Thursday, July 25, 2013 8:51 AM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Monday, November 3, 2014 8:05 AM
Points: 1,191, Visits: 9,892
Chris Downing (7/25/2013)
We're using an OLEDB Command task to execute the stored procedure, and I believe that treats it as dynamic SQL and executes that new system sproc as part of validation (we're not doing it explicitly). So this worked fine prior to 2012 obviously, but once we upgrade, it started erroring out when it hit that task.


OK. Definitely sounds like a bug. Have you got support with Microsoft?
Post #1477548
Posted Thursday, July 25, 2013 11:45 AM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: 2 days ago @ 7:42 AM
Points: 229, Visits: 394
HowardW (7/25/2013)
OK. Definitely sounds like a bug. Have you got support with Microsoft?


I posted over on the MS Forums as well and basically got a "yep, this is how it works for me too", as well as a work around. The work around (to not explicitly have the parameter names in the exec query) works, but doesn't actually prevent us from having to make a bunch of changes, and may not even work in certain situations.

So I've opened up a bug here... https://connect.microsoft.com/SQLServer/feedback/details/795002/sp-describe-undeclared-parameters-case-sensitive-despite-collation

Thanks for checking it out and confirming we aren't crazy!
Post #1477652
Posted Friday, July 26, 2013 4:22 AM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Monday, November 3, 2014 8:05 AM
Points: 1,191, Visits: 9,892
I've up-voted it and confirmed I can reproduce
Post #1477927
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse