Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SQL

cast in sql

SELECT CAST(25.65 AS int); -- Result : 25
SELECT CAST(25.65 AS int); -- Result : 25
SELECT CAST('25.65' AS decimal(10,2)); -- Result : 25.65 
SELECT CONVERT(VARCHAR(20), 10) -- Result :10
SELECT CONVERT(NVARCHAR(20), 10) -- Result :10 
select convert(varchar, getdate(), 1); -- Result : mm/dd/yyyy
Source by www.mssqltips.com #
 
PREVIOUS NEXT
Tagged: #cast #sql
ADD COMMENT
Topic
Name
7+1 =