Home > Archive > MS SQL Server > December 2006 > Conversion









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Conversion
Dutt

2006-12-12, 7:12 pm

Hi,
I encounter a strange problem.Here down,I explain it.Pls anyone give me
solution.

typeID is of INT type

In a storedprocedure,when
used as


typeID='+cast(23 as varchar)+'


it is getting executed but when i break the stored procedure,it is
showing error
as below:

Syntax error converting the varchar value '+CAST(23 AS VARCHAR)+' to a
column of data type int.

Thanks

SunilDutt N.

Uri Dimant

2006-12-12, 7:12 pm

Dutt
INT is highest in terms of Data Type Precedence, thuis you 've got a error.
SQL Server tries to convert a varachar (lower) to INT (higher)




"Dutt" <Mr.Dutt@gmail.com> wrote in message
news:1165930651.040999.302700@16g2000cwy.googlegroups.com...
> Hi,
> I encounter a strange problem.Here down,I explain it.Pls anyone give me
> solution.
>
> typeID is of INT type
>
> In a storedprocedure,when
used as
>
>
> typeID='+cast(23 as varchar)+'
>
>
> it is getting executed but when i break the stored procedure,it is
> showing error
> as below:
>
> Syntax error converting the varchar value '+CAST(23 AS VARCHAR)+' to a
> column of data type int.
>
> Thanks
>
> SunilDutt N.
>



Dutt

2006-12-12, 7:12 pm

Uri,
But,its working in the sp.
Thanks
Dutt
Uri Dimant wrote:[color=darkred
]
> Dutt
> INT is highest in terms of Data Type Precedence, thuis you 've got a error.
> SQL Server tries to convert a varachar (lower) to INT (higher)
>
>
>
>
> "Dutt" <Mr.Dutt@gmail.com> wrote in message
> news:1165930651.040999.302700@16g2000cwy.googlegroups.com...

Uri Dimant

2006-12-12, 7:12 pm

Dutt
Can you show us entire source?


"Dutt" <Mr.Dutt@gmail.com> wrote in message
news:1165931759.413557.54020@73g2000cwn.googlegroups.com...
> Uri,
> But,its working in the sp.
> Thanks
> Dutt
> Uri Dimant wrote:
>



Dutt

2006-12-13, 5:18 am

Hi Uri,
I got it.
It was a dynamic SQL statement with a lot of quotes which bring
confusion.
Thanq.
Dutt.
Uri Dimant wrote:[color=darkred
]
> Dutt
> Can you show us entire source?
>
>
> "Dutt" <Mr.Dutt@gmail.com> wrote in message
> news:1165931759.413557.54020@73g2000cwn.googlegroups.com...

Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2009 droptable.com