Skip to content

Instantly share code, notes, and snippets.

@ArCiGo
Last active May 19, 2019 22:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ArCiGo/0e5ba92fba7b37eeaaf6bb611602e7e9 to your computer and use it in GitHub Desktop.
Save ArCiGo/0e5ba92fba7b37eeaaf6bb611602e7e9 to your computer and use it in GitHub Desktop.
DECLARE @myDecimalValue FLOAT
SET @myDecimalValue = 3.1415
SELECT CAST(@myDecimalValue AS INT);
GO
/** Output **/
-----------
3
DECLARE @myDecimalValue FLOAT
SET @myDecimalValue = 4521312.531
SELECT CONVERT(INT, @myDecimalValue);
GO
/** Output **/
-----------
4521312
SELECT TOP 5 *
FROM Customer;
GO
/** Output **/
Id FirstName LastName City Country Phone
----------- ---------------------------------------- ---------------------------------------- ---------------------------------------- ---------------------------------------- --------------------
1 Maria Anders Berlin Germany 030-0074321
2 Ana Trujillo México D.F. Mexico (5) 555-4729
3 Antonio Moreno México D.F. Mexico (5) 555-3932
4 Thomas Hardy London UK (171) 555-7788
5 Christina Berglund Luleå Sweden 0921-12 34 65
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment