Viewing 15 posts - 7,426 through 7,440 (of 10,144 total)
No worries.
Consider making your WHERE clauses SARGable:
DECLARE @Startmonth DATE, @Endmonth DATE, @Startday DATE, @Endday DATE
SET @Startmonth = DATEADD(MONTH,DATEDIFF(MONTH,0,GETDATE()),0)
SET @Endmonth = DATEADD(MONTH,1,@Startmonth)
SET @Startday = DATEADD(day,DATEDIFF(day,0,GETDATE()),0)
SET @Endday = DATEADD(day,1,@Startday)
SELECT @Startmonth, @Endmonth, @Startday,...
September 9, 2010 at 9:24 am
You forgot to correlate your correlated subquery:
SELECT OwnerStaff_Branch,
COUNT(WorkOrderID) AS MonthTotal,
(SELECT COUNT(WorkOrderID) AS Expr1
FROM WorkOrderReportView
WHERE (dbo.DateOnly(CreatedOn) = dbo.DateOnly(GETDATE())
AND OwnerStaff_Branch = w.OwnerStaff_Branch)
) AS DailyTotal
FROM WorkOrderReportView w
WHERE (MONTH(CreatedOn) = MONTH(GETDATE())) AND (YEAR(CreatedOn)...
September 9, 2010 at 9:12 am
The check for existence looks way too complicated - this should work:
INSERT INTO SERVERS_V
(
SERVER_ID,
SERVER_NAME,
SERVER_MAKE,
.
.
.
SERVER_TIMEZONE
)
SELECT
SERVER_ID,
SERVER_NAME,
SERVER_MAKE,
.
.
.
SERVER_TIMEZONE
FROM SERVERS_VT
WHERE NOT EXISTS (SELECT 1 FROM SERVERS_V WHERE SERVER_ID = SERVERS_VT.SERVER_ID)
September 9, 2010 at 8:49 am
Vasudev Tantry (9/9/2010)
Thanks Crazy..
You're welcome, Forum Newbie 😛
September 9, 2010 at 8:10 am
Use CASE.
IF enables you to distinguish between statements, CASE enables you to distinguish between values.
SELECT
c.c_fname AS [First Name],
c.c_lname AS [Last Name],
c.c_nick_name AS [Emp Id],
b.b_number_str AS [Card...
September 9, 2010 at 7:10 am
Jack Corbett (9/9/2010)
September 9, 2010 at 6:22 am
Whether you're permy or contracting, it seems to me that the three KPIs affecting happiness at work are money, people, and the actual work you're doing.
All three and you're...
September 9, 2010 at 5:59 am
chetanr.jain (9/8/2010)
I require a little help on string query.
I have two table ( Table A and Table B) each having employee column with string values.
I want to search that does...
September 9, 2010 at 5:44 am
Jeff Moden (9/9/2010)
September 9, 2010 at 5:36 am
declare @returnvalue float
set @ReturnValue = ((6840844991.81 + 113664947.42) - (6947944500.34 + 2417617.57)) / (6947944500.34 + 2417617.57)
SELECT @ReturnValue --this is the correct calculated float number
-- truncate to 16dp
SELECT CONVERT(DECIMAL(26,16),@ReturnValue)
-- Use...
September 9, 2010 at 5:08 am
Surely this would be tons easier and quicker if you were to normalise out the categories quite early on?
DROP TABLE #Temp
CREATE TABLE #Temp (ID INT IDENTITY(1,1), Name VARCHAR(30), [Address] VARCHAR(60),...
September 9, 2010 at 2:46 am
WayneS (9/8/2010)
Chris Morris-439714 (9/8/2010)
WayneS (9/8/2010)
September 8, 2010 at 9:40 am
WayneS (9/8/2010)
September 8, 2010 at 9:26 am
CirquedeSQLeil (9/8/2010)
Chris Morris-439714 (9/8/2010)
CirquedeSQLeil (9/8/2010)
eep opp ork ah ahLike a Richmond sausage, you know there's pork in there somewhere.
p ork ahhhhhh
LOL
You need one of those dandy 360o sofas.
September 8, 2010 at 9:19 am
CirquedeSQLeil (9/8/2010)
eep opp ork ah ah
Like a Richmond sausage, you know there's pork in there somewhere.
September 8, 2010 at 9:02 am
Viewing 15 posts - 7,426 through 7,440 (of 10,144 total)