Viewing 15 posts - 8,476 through 8,490 (of 19,560 total)
Please provide your table structure (table create script).
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events
September 28, 2011 at 2:48 pm
Lowell (9/28/2011)
,dateadd(m,datediff(m,0,dateadd(m,1,getdate())),+3) As Date_3
the "+3" in the above is a DATE...not the number of days to add. it's...
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events
September 28, 2011 at 2:46 pm
Try this instead
DECLARE @ThisDate DATETIME = GETDATE()
Select
@ThisDate As Date_1
,dateadd(m,datediff(m,0,dateadd(m,1,@ThisDate)),0)+3 As Date_3
,dateadd(m,datediff(m,0,dateadd(m,1,@ThisDate)),0)+2 As Date_4
,dateadd(m,datediff(m,0,dateadd(m,1,@ThisDate)),0)+1 As Date_5
,dateadd(m,datediff(m,0,dateadd(m,1,@ThisDate)),0) As Date_6
,dateadd(m,datediff(m,0,dateadd(m,1,@ThisDate)),0)-1 As Date_7
,dateadd(m,datediff(m,0,dateadd(m,1,@ThisDate)),0)-2 As Date_8
,dateadd(m,datediff(m,0,dateadd(m,1,@ThisDate)),0)-3 As Date_9
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events
September 28, 2011 at 2:40 pm
Yes - you can adapt this script to your actual table. However, you will still need the two subqueries inside that single select statement that has been provided.
Just change...
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events
September 28, 2011 at 2:25 pm
The only reason for that table variable was due to the need to create a testable script.
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events
September 28, 2011 at 2:17 pm
Try this updated script:
SELECT tabletext,RTRIM(LTRIM(Substring(deliveryText, start -1, length - start - fromEnd + 3))) AS [extracted]
FROM (
SELECT tabletext,MAX(PATINDEX([Matched], tableText)) AS start
...
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events
September 28, 2011 at 2:10 pm
Sean Lange (9/28/2011)
GSquared (9/28/2011)
select *from dbo.MyTable
order by case Users when 'ALL' then 1 else 2 end, Users ;
That avoids even things like entries that begin with low-ASCII-value punctuation coming...
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events
September 28, 2011 at 1:56 pm
In SQL 2000, the recovery model is not displayed in the system catalogue like it is in 2005. However, thanks to the magic of functions you can retrieve it...
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events
September 28, 2011 at 1:55 pm
Cadavre (9/28/2011)
--Some test data firstDECLARE @TABLE AS TABLE (tableText VARCHAR(1000))
INSERT INTO @TABLE
SELECT 'Some Product Name Here 3.7mmD X 8mmL (SBM)
Product Code: 103708
<span style="color:red;">Availability: 9/26/2011</span>'
UNION ALL SELECT 'Some Product Name Here...
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events
September 28, 2011 at 1:47 pm
To capture the actual connection string you would need a packet capture.
To get all the relevant information for the connection, try querying sys.dm_exec_sessions
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events
September 28, 2011 at 1:15 pm
Is there another field in the database (such as PK) that would help in sorting this data in the desired way?
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events
September 28, 2011 at 1:01 pm
Is the schema frequently changing?
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events
September 28, 2011 at 12:58 pm
bcsims 90437 (9/28/2011)
crookj (9/28/2011)
Ray K (9/28/2011)
stressedDitto - Not a good week so far.....
(But I do see the lgiht at the end of the tunnel)
But is it the train at the...
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events
September 28, 2011 at 10:45 am
Daniel Bowlin (9/28/2011)
crookj (9/28/2011)
Ray K (9/28/2011)
stressedDitto - Not a good week so far.....
(But I do see the lgiht at the end of the tunnel)
The light at the end of the...
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events
September 28, 2011 at 10:44 am
GSquared (9/28/2011)
SQL Kiwi (9/28/2011)
WayneS (9/27/2011)
• ...
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events
September 28, 2011 at 10:39 am
Viewing 15 posts - 8,476 through 8,490 (of 19,560 total)