Viewing 15 posts - 3,916 through 3,930 (of 5,504 total)
The Dixie Flatline (3/24/2010)
Did you not even look at my example casting an integer as SQL_VARIANT datatype?
The main reason why I try to avoid SQL_VARIANT is the need to cast...
March 24, 2010 at 12:43 pm
Maybe this argument will help, too:
Within one query, SQL server will only use one index per table. So, if you have the following querySELECT col1, col2, col3, col4
FROM table
WHERE col1='something'...
March 24, 2010 at 12:19 pm
Glad I could help 🙂
And I'd like to thank you for taking the time to set up sample data in a ready to use format. Made it easy to work...
March 24, 2010 at 11:39 am
Is it something like the following that you're looking for?
Please note that I used the STR() function to convert the numeric value to to a string data type:
DECLARE @tbl TABLE
(
...
March 24, 2010 at 10:59 am
Please help us help you and provide ready to use sample data.
The most efficient way how to do that is described in the first link in my signature.
Providing some Excel...
March 23, 2010 at 5:47 pm
BTW, where did you get [0-Z] from. I was surprised to see that ':' or ';' do not fall within that range when using a collation like Latin1_General_CI_Ax. I scanned...
March 23, 2010 at 5:38 pm
You should use equal comparison rather than not equal.
CASE isComments WHEN 1 THEN rd.responseComments
WHEN 0 THEN ''
...
March 23, 2010 at 1:52 pm
Thanx for clarification, Peter!
I knew there must have been a reason Lowell provided a method that seemed to leave room for improvement... :blush:
March 23, 2010 at 1:46 pm
I would look into a Tally table solution with CROSS APPLY or a split string function together with an intermediate table and a quirky update or any combination of those...
March 23, 2010 at 1:40 pm
The main question is: what logic do you use to define the week number?
Are you using ISO week, SQL standard (January 1st = week 1), DATEFIRST dependent or not or...
March 23, 2010 at 1:26 pm
What's on your list so far?
March 23, 2010 at 1:18 pm
Lynn Pettis (3/23/2010)
lmu92 (3/23/2010)
Why would you use two functions for this task rather than doing it all at once?
My wild guess would be that the pure UNPIVOT solution should be...
March 23, 2010 at 1:12 pm
Why would you use two functions for this task rather than doing it all at once?
My wild guess would be that the pure UNPIVOT solution should be more efficient. What...
March 23, 2010 at 1:01 pm
Maybe you could make the CASE statement of Lowells nice function a little shorter:
CASE
WHEN (SUBSTRING(@OriginalText,Tally.N,1)) like '[0-Z]'
THEN SUBSTRING(@OriginalText,Tally.N,1)
ELSE '' END
It seems...
March 23, 2010 at 12:52 pm
Would something like this help?
DECLARE @tbl TABLE
(id INT,
c1 DATETIME,
c2 DATETIME,
c3 DATETIME,
c4 DATETIME
)
INSERT INTO @tbl
SELECT 1,GETDATE(), GETDATE()-1,GETDATE()-2,GETDATE()+3 UNION ALL
SELECT 2,GETDATE()-5, GETDATE()-6,GETDATE()-4,GETDATE()-3
;WITH cte AS
(
SELECT id,DateVal
FROM...
March 23, 2010 at 12:35 pm
Viewing 15 posts - 3,916 through 3,930 (of 5,504 total)