Viewing 15 posts - 3,241 through 3,255 (of 4,087 total)
Use a CASE statement.
WITH TestSuite(Col1, Test, Outcome) AS (
SELECT 1, 'test1', 'Passed' UNION ALL
SELECT 2, 'test2', 'Failed' UNION ALL
SELECT 3, 'test3', 'NotExec' UNION ALL
SELECT 4, 'test4', 'Blocked' UNION ALL
SELECT 5,...
April 11, 2012 at 12:01 pm
You say that you are supplying one parameter, but you don't say what value you're supplying to that parameter.
You say that name contains pen and pencil, but the data provided...
April 11, 2012 at 11:52 am
Using datapart, you'll lose the leading zeros. Convert it to the format closest to what you want and then clean it up using REPLACE.
SELECT REPLACE(REPLACE(REPLACE(CONVERT(varchar(25), GETDATE(), 120), '-', ''),...
April 11, 2012 at 9:12 am
Please do not create duplicate posts for the same topic. It fragments the replies. Please respond in this thread. http://www.sqlservercentral.com/Forums/Topic1281038-392-1.aspx
Drew
April 11, 2012 at 9:05 am
GilaMonster (4/11/2012)
Semicolons are statement terminators, as such they should terminate statements, not start them. We don't start sentences in English with fullstops.
T-SQL is a completely different language from English with...
April 11, 2012 at 8:52 am
If the ultimate goal is concatenation, then there's no reason to shift columns left. Just do the concatenation as normal.
with mySampleData (id,addr1,addr2,addr3)
AS
(
SELECT'1','123',NULL,'Main St.' UNION ALL
SELECT'2',NULL,NULL,NULL UNION ALL
SELECT'3',NULL,'345','Elm St.'...
April 10, 2012 at 11:30 am
Part of the problem is that the OP specified a particular route to the destination when only the destination is important. There are really only three conditions:
Between Friday at...
April 9, 2012 at 10:28 am
There are just too many variables to recommend one approach over another. You'll need to test several different approaches to see which one works best with your data.
A table...
April 9, 2012 at 7:13 am
Henry Treftz (4/6/2012)
April 9, 2012 at 6:49 am
A CTE is part of the following INSERT, SELECT, or UPDATE statement and does not exist outside of that scope. If you need to use the same set of...
April 6, 2012 at 3:33 pm
Sorry, misread the SQL.
April 6, 2012 at 3:13 pm
Jeff Moden (4/5/2012)
I guess that I'm still amazed that such a simple structure requires 3 selects to return the hierarchy.
It doesn't. As with almost everything, there are multiple ways...
April 6, 2012 at 8:44 am
I think you mean MDX. You cannot directly translate SQL to MDX. Even though there are some superficial similarities, they are completely different languages, because they query completely...
April 5, 2012 at 2:47 pm
SSIS requires that each of the records have the same structure. Since your header records have a different structure than your detail records, you can't do this directly in...
April 5, 2012 at 2:11 pm
Here is another possibility. Since you haven't provided test data, it's difficult to compare the various methods. This method only scans the table once, but has more logical...
April 5, 2012 at 8:17 am
Viewing 15 posts - 3,241 through 3,255 (of 4,087 total)