how to get data of current week only in SQL server?

Do it like this: SET DATEFIRST 1 — Define beginning of week as Monday SELECT […] AND WorkDate >= dateadd(day, 1-datepart(dw, getdate()), CONVERT(date,getdate())) AND WorkDate < dateadd(day, 8-datepart(dw, getdate()), CONVERT(date,getdate())) Explanation: datepart(dw, getdate()) will return the number of the day in the current week, from 1 to 7, starting with whatever you specified using SET … Read more

SQL Server – after insert trigger – update another column in the same table

It depends on the recursion level for triggers currently set on the DB. If you do this: SP_CONFIGURE ‘nested_triggers’,0 GO RECONFIGURE GO Or this: ALTER DATABASE db_name SET RECURSIVE_TRIGGERS OFF That trigger above won’t be called again, and you would be safe (unless you get into some kind of deadlock; that could be possible but … Read more

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