December 3, 2008 at 12:08 pm
I have an ASPX page that references a stored procedure. That page strings the ID that I need to pass into the stored procedure. In my stored procedure, that ID gets passed into the where clause as:
DonationID = @DonationID
The problem is that the page passes the id using a { at the beginning and a } at the end. I need to trim these off of the ID. My idea was that I could trim this off in my SP on my @DonationID. Is there a way to do this, or am I taking the wrong approach. Thanks guys.
December 3, 2008 at 12:25 pm
I'd strip it in .NET.
You can do it easy enough in SQL too. Replace(Replace(@DonationID, '{', ''), '}', '')
Jack Corbett
Consultant - Straight Path Solutions
Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question
December 3, 2008 at 12:25 pm
It sounds like your application my be passing a GUID. If that is the case, just cast it to a uniqueidentifier in SQL and it will remove the curly braces. Here is an example.
Declare @DonationID varchar(50)
Set @DonationID = '{' + cast(NewID() as varchar(50)) + '}'
Select @DonationID
Select Cast(@DonationID as uniqueidentifier)
December 4, 2008 at 7:01 am
Jack Corbett (12/3/2008)
I'd strip it in .NET.You can do it easy enough in SQL too. Replace(Replace(@DonationID, '{', ''), '}', '')
Worked like a charm. I didnt think I could do a replace on a variable. This is awesome and will help in the future. Thanks!
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply