Covert | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

Covert

What is wrong ? I have table where is column dolneCislo …bigint When is code running I make with variable @novCis_Kon (varchar (255)).
In some moment I need to update column dolneCislo with value in @novcis. What is correct statement for convert and update this sample ? If it isn’ possible , i can change format of column dolneCislo. But I am doing with number with long 10 digits. Thanks, Lubo i Apologize my english

Let me see – the maximum value that BIGINT can hold is 9,223,372,036,854,775,807 – that’s 19 digits. So as long as you stay within 10 digits there’s no problem (well, you must make sure that the digits are strictly numbers). The proper syntax is either CAST(dolneCislo AS BIGINT) or CONVERT(BIGINT, dolneCislo) – though I assume you can insert/update the string without casting or converting.
I need to do statement set @sqlCommand =’ Update Linky Set dolneCislo= ‘ [email protected]_Zac + ‘ where id=’+ @ident I don’t understand your answer.. I need to do
value_of_ @novCis_Zac -> column_dolneCislo

Sorry, I mentioned the column name instead of your variable. From what you’re showing here, it doesn’t look like you have to use dynamic SQL – this should work already:
Update Linky Set dolneCislo= @novCis_Zac where id= @ident Or else
Update Linky Set dolneCislo= CAST(@novCis_Zac AS BIGINT) where id= @ident

Adriaan , THANK YOU VERY MUCH for your advice !
Lubo
]]>