Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Microsoft SQL Server 2005 cast bigint to string

How can I cast a bigint variable to a string?

DECLARE @id bigint
like image 701
Kevin Avatar asked Apr 14 '10 20:04

Kevin


People also ask

Can you type CAST in SQL?

You can cast to many SQL Server types such as binary , char , varchar , date , datetime , time , decimal , bigint , and float .

What is CAST () and convert () functions in SQL Server?

The cast and convert functions provide similar functionality. They are used to convert a value from one data type to another. So let's take a look at a practical example. The example is developed in SQL Server 2012 using the SQL Server Management Studio.

Which is better CAST or convert in SQL?

CAST is also less powerful and less flexible than CONVERT. On the other hand, CONVERT allows more flexibility and is the preferred function to use for data, time values, traditional numbers, and money signifiers. CONVERT is also useful in formatting the data's format.


1 Answers

select CAST(@id as varchar(max))
like image 64
D'Arcy Rittich Avatar answered Sep 20 '22 19:09

D'Arcy Rittich