sql server - I can not declare bigint variable -
in sql server can't declare variable bigint data type. mobile column has bigint data type. it's give me error varchar not convert bigint when use procedure.
when write mobile=cast(@mobile varchar) works fine
alter procedure [dbo].[get_suggestion] @firstname varchar(255), @middlename varchar(255), @lastname varchar(255), @mobile bigint begin select * dbo.contacts ( mobile =@mobile ) end table structure
drop table [dbo].[contacts] go create table [dbo].[contacts] ( [contactid] int not null identity(1,1) , [name] varchar(100) not null , [familyheadid] int null , [addressold] ntext null , [mobile] bigint null , calling
get_suggestion 'john','doe','patel',999999999
it's because mobile not integer varchar in table , hence sql server tries convert mobile column bigint when compare @mobile in where mobile =@mobile
mobile=cast(@mobile varchar) the above works because there no implicit conversion of mobile column bigint.
edit
based on updated question, should work fine. check sql fiddle
Comments
Post a Comment