Viewing 15 posts - 1,306 through 1,320 (of 8,731 total)
Maybe something like this would work.
SELECT COL1, COL2, NEW_COLUMN
FROM TABLE
CROSS APPLY (VALUES('COL3', CAST( COL3 AS varchar(100))),
('COL4', CAST( COL4 AS varchar(100))),
('COL5',...
May 8, 2017 at 9:32 am
This should be efficient as it reads the table only once.
WITH ClockCounts AS(
SELECT COUNT(*) AS ClockIn ,
COUNT(EndTime) AS ClockOut
FROM...
May 8, 2017 at 6:04 am
Even simpler. You're basically trying to query the current month for the day before.
DECLARE @StartDate date = DATEADD(mm, DATEDIFF( mm, 0, GETDATE() - 1), 0);
DECLARE...
May 8, 2017 at 5:51 am
Wild idea:
Why don't you simply update the table instead of deleting and re-inserting?
May 5, 2017 at 1:21 pm
May 5, 2017 at 10:44 am
Actually, ROUND uses 3 parameters. The third parameter indicates if it needs to truncate or round.
There's a difference on how FLOOR and ROUND work with negatives.
I explain...
May 5, 2017 at 6:49 am
You also want to use QUOTENAME() to handle complex names for your columns or objects.
DECLARE @Field_suffix char(1);
DECLARE @sql varchar(MAX);
SET @Field_suffix = '1';
May 5, 2017 at 6:14 am
Try this:
DECLARE @sql nvarchar(max)
SELECT @sql = N'SELECT H.UserID' + CHAR(10)
+ STUFF(( SELECT CHAR(10) + CHAR(9) + ',ISNULL( NULLIF( H.' + QUOTENAME(COLUMN_NAME) + ',...
May 4, 2017 at 12:50 pm
May 4, 2017 at 12:19 pm
May 4, 2017 at 11:51 am
Could you be missing the ROWS clause in the OVER()?
DECLARE @MaxRecords int = 500;
WITH MyLimits
AS
(
SELECT SUM(COUNT(colz.OBJECT_ID)) OVER( ORDER...
May 4, 2017 at 11:49 am
SELECT count(*),May 4, 2017 at 8:37 am
May 3, 2017 at 12:00 pm
Viewing 15 posts - 1,306 through 1,320 (of 8,731 total)