Sqlcmd to generate file without dashed line under header, without row count

Solutions: 1) To remove the row count (“(139 rows affected)”) you should use SET NOCOUNT ON statement. See ref. 2) To remove column headers you should use -h parameter with value -1. See ref (section Formatting Options). Examples: C:\Users\sqlservr.exe>sqlcmd -S(local)\SQL2012 -d Test -E -h -1 -s, -W -Q “set nocount on; select * from dbo.Account” … Read more

Are there any Linear Regression Function in SQL Server?

To the best of my knowledge, there is none. Writing one is pretty straightforward, though. The following gives you the constant alpha and slope beta for y = Alpha + Beta * x + epsilon: — test data (GroupIDs 1, 2 normal regressions, 3, 4 = no variance) WITH some_table(GroupID, x, y) AS ( SELECT … Read more

What’s the point to enclose select statements in a transaction?

You’re right: at the standard isolation level, read committed, you do not need to wrap select statements in transactions. Select statements will be protected from dirty reads whether you wrap them in a transaction or not. connection 1: connection 2: begin transaction update user set name=”Bill” where id = 1 select name from users where … Read more

tech