Posts Tagged ‘Expression’

T-SQL Convert INT to Comma-Separated Nvarchar

T-SQL Convert INT to Comma-Separated Nvarchar SQL expression to change an Int like 123456789 to a comma-separated Nvarchar like ‘123,456,789.00’. DECLARE @MyNum INT =123456789 SELECT CONVERT(Nvarchar, CONVERT(MONEY, @MyNum), 0) –result: 123456789.00 SELECT CONVERT(Nvarchar, CONVERT(MONEY, @MyNum), 1) –result: 123,456,789.00 SELECT CONVERT(Nvarchar, CONVERT(MONEY, @MyNum), 2) –result: 123456789.0000

More »

CASE (Transact-SQL)

usage -> Evaluates a list of conditions and returns one of multiple possible result expressions. CASE can be used in any statement or clause that allows a valid expression. For example, you can use CASE in statements such as SELECT, UPDATE, DELETE and SET. and in clauses such as select_list, IN, WHERE, ORDER BY, and […]

More »