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

How to print DateTime variable in the RAISERROR method?

The supplied value must be a constant or a variable. You cannot specify a function name as a parameter value. (from MSDN Executing Stored Procedures). You need to do something like this: declare @EffectiveStartDateText varchar(30) set @EffectiveStartDateText = cast(@EffectiveStartDate as varchar) declare @EffectiveEndDateText varchar(30) set @EffectiveEndDateText = cast(@EffectiveEndDate as varchar) RAISERROR ( ‘SPName: InsertUpdateLiquidityDateRule: Start … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)