Viewing 15 posts - 136 through 150 (of 161 total)
i suppose you could add this to the where clause
AND PIT != CONVERT(CHAR(10),GETDATE(),121) + '16:00:00'
This will check the PIT column and exclude the current day at 16:00. Remember though...
February 2, 2012 at 1:52 am
personall i prefer a join - like so:
DELETE a
FROMtablea a
INNER JOINtableb b
ONa.column = b.column
WHEREcondition
As far as standards go - i'm not too sure,...
February 2, 2012 at 1:47 am
This may be a bit ott, but check this out:
This is the sql server central management system.
You can use policies (using the policy management framework) to check the...
February 1, 2012 at 2:45 am
so you have another column called PIT which holds datetime values?
February 1, 2012 at 1:16 am
david.ostrander (1/31/2012)
You have helped me out so much Thank you... I can see how it all works now.
Thats what the community is for right ? 🙂
January 31, 2012 at 12:45 pm
It certainly is possible 🙂
WHERE[DateTime_Column] >= CONVERT(CHAR(10),DATEADD(DD,-7,GETDATE()),121)
AND[DateTime_Column] < CONVERT(CHAR(10),DATEADD(DD,91,GETDATE()),121)
the dateadd function is very flexible. You can + or - days, months, years, minutes, hours etc. play around with...
January 31, 2012 at 12:21 pm
I don't quite understand, 1 week back would be 24th jan 🙂
January 31, 2012 at 11:55 am
for a view instead of declaring variables change the where clause to the following;
WHERE[DateTime_Column] >= CONVERT(CHAR(10),GETDATE(),121)
AND[DateTime_Column] < CONVERT(CHAR(10),DATEADD(DD,91,GETDATE()),121)
January 31, 2012 at 11:43 am
what version of sql server are you using? The way i've declared the variables are specific to sql 2008 +
January 31, 2012 at 11:40 am
a select statement could look like the following:
DECLARE @DateStart DATETIME = CONVERT(CHAR(10),GETDATE(),121);
DECLARE @DateEnd DATETIME = DATEADD(DD, 91, @DATESTART);
SELECT*
FROM
WHERE[DateTime_Column] >= @DateStart
AND[DateTime_Column] < @DateEnd
Hope that helps
//Edit made the dateadd add 91 days...
January 31, 2012 at 11:13 am
GilaMonster (1/27/2012)
Excellent as that book it, it assumes some knowledge.For basic T-SQL, try Itzik Ben-Gan's T-SQL Fundamentals. Not sure about a beginner's guide to SQL Server though
I've attended one of...
January 31, 2012 at 3:49 am
exec or execute
http://msdn.microsoft.com/en-us/library/ms188332.aspx
sp_executesql
http://msdn.microsoft.com/en-us/library/ms188001.aspx
simples.
January 31, 2012 at 3:40 am
SQL Kiwi (1/31/2012)
Loundy (1/31/2012)
January 31, 2012 at 3:24 am
I believe something like this will do the trick.
CREATE TABLE #table1 (ID INT,SIN_ID INT,AgentCode_ID VARCHAR(30), Amount DECIMAL(5,2))
CREATE TABLE #table2 (ID INT,SIN_ID INT,AgentCode_ID VARCHAR(30), Amount DECIMAL(5,2))
CREATE TABLE #table3 (ID INT,SIN_ID INT,AgentCode_ID...
January 31, 2012 at 2:32 am
Paul,
I've seen a few examples on the forums where some people have used a CTE with the row_number() function and others have used cross apply - I understand both...
January 31, 2012 at 1:44 am
Viewing 15 posts - 136 through 150 (of 161 total)