July 24, 2008 at 5:51 am
I've created procedure
Create procedure [dbo].[Options] @COMPANY_ID varchar
as
declare @company_IdUnique uniqueidentifier
--The reason why iam converting below is i have to insert the row into the table in which companyId is uniqueidentifier.
set @company_IdUnique = cast(@COMPANY_ID as uniqueidentifier)
--Some SQL statements follow here
--Test Calling the store procdure from sql
exec CompanyOptionsFreeForm 'b7a83d8-e6d7-415f-9664-056e2ea7ea0b'
--But it is giving the following error
Syntax error converting from a character string to uniqueidentifier.
--how to pass the value to the unique identifier param.
July 24, 2008 at 6:04 am
santosh_kollipaka (7/24/2008)
I've created procedureCreate procedure [dbo].[Options] @COMPANY_ID varchar
as
declare @company_IdUnique uniqueidentifier
--The reason why iam converting below is i have to insert the row into the table in which companyId is uniqueidentifier.
set @company_IdUnique = cast(@COMPANY_ID as uniqueidentifier)
--Some SQL statements follow here
--Test Calling the store procdure from sql
exec CompanyOptionsFreeForm 'b7a83d8-e6d7-415f-9664-056e2ea7ea0b'
--But it is giving the following error
Syntax error converting from a character string to uniqueidentifier.
--how to pass the value to the unique identifier param.
try setting the varchar size in the porcedure declaration, otherwise it will be defaulted to varchar(1) - making your cast trying to get a GUID from 'b'
Kev
July 24, 2008 at 6:11 am
Hi kev,
Even though i set the varchar(60) , still iam getting the same error.
July 24, 2008 at 7:46 am
the example you give 'b7a83d8-e6d7-415f-9664-056e2ea7ea0b' isn't a valid GUID - the first part before the first hyphen needs to have 8 characters
Kev
July 25, 2008 at 1:11 am
Thank you kev that is the problem , now it is solved.
August 11, 2010 at 8:06 pm
VARCHAR defaults to 50, right? Same length as a "sysname"?
Viewing 6 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy