Viewing 15 posts - 1,786 through 1,800 (of 3,738 total)
Eugene Elutin (2/16/2012)
sturner (2/16/2012)
Eugene Elutin (2/16/2012)
Using CTE would still produce neattier looking code...
CTE or not, a syntax error is a syntax error. I'm happy the OP resolved his issue but...
For better, quicker answers on T-SQL questions, click on the following...
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
February 16, 2012 at 8:56 am
I revised my code and created a simple CTE and that solved the problem.
WITH CTE
AS
(SELECTResCalc.CONVNO,
CASE
WHEN ResCalc.ACCDESC IN('Beef','Pork','Chicken') THEN 'Meat'
WHEN ResCalc.ACCDESC IN('Shrimp', 'Fish','Crab','Lobster') THEN 'Seafood'
WHEN ResCalc.ACCDESC IN('Orange','Apple','Pear','Plum')...
For better, quicker answers on T-SQL questions, click on the following...
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
February 16, 2012 at 8:15 am
sturner (2/16/2012)
Welsh Corgi (2/16/2012)
sturner (2/16/2012)
as calvo stated, you'll need to include the complete case statement in your group by.I tried it and I get a syntax error.:-D
bet you left the...
For better, quicker answers on T-SQL questions, click on the following...
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
February 16, 2012 at 8:12 am
I was able to solve the problem by using a simple CTE.
Thanks for the suggestions.
For better, quicker answers on T-SQL questions, click on the following...
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
February 16, 2012 at 8:08 am
Eugene Elutin (2/16/2012)
What query have you tried?Have you copied CASE statement together with AS [ColumnName]?
If so remove "AS [ColumnName]" from GROUP BY
I tried it and it did not work.
Thanks for...
For better, quicker answers on T-SQL questions, click on the following...
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
February 16, 2012 at 8:07 am
sturner (2/16/2012)
as calvo stated, you'll need to include the complete case statement in your group by.
I tried it and I get a syntax error.:-D
For better, quicker answers on T-SQL questions, click on the following...
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
February 16, 2012 at 7:51 am
Thanks for the reply.
This is what the CASE looks like:
SELECTCOUNT(ResCalc.CONVNO) AS RecordCount,
CASE
WHEN ResCalc.ACCDESC IN('Beef','Pork','Chicken') THEN 'Meat'
WHEN ResCalc.ACCDESC IN('Shrimp', 'Fish','Crab','Lobster') THEN 'Seafood'
WHEN ResCalc.ACCDESC IN('Orange','Apple','Pear','Plum') THEN 'Fruit'
WHEN ResCalc.ACCDESC...
For better, quicker answers on T-SQL questions, click on the following...
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
February 16, 2012 at 7:18 am
Rings a bell.:-)
Thanks Lowell!
For better, quicker answers on T-SQL questions, click on the following...
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
February 15, 2012 at 3:22 pm
Thanks Lowell. I had created the Linked Server and used a Login on the AS400.
I just wanted to make sure that I did not forget anything before the Users tested...
For better, quicker answers on T-SQL questions, click on the following...
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
February 15, 2012 at 3:22 pm
Thanks, I was not concerned about the mappings, just the login.
I've dropped Linked Servers before and it did not drop any Logins.
For better, quicker answers on T-SQL questions, click on the following...
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
February 14, 2012 at 9:04 am
Admingod (2/13/2012)
Thanks you guys....
And Gals;-)
For better, quicker answers on T-SQL questions, click on the following...
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
February 14, 2012 at 7:20 am
You have to run the script for each database.
Also I get an error when running the script.
Msg 911, Level 16, State 1, Line 33
Could not locate entry in sysdatabases for...
For better, quicker answers on T-SQL questions, click on the following...
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
February 14, 2012 at 5:31 am
It's nice but it converts ' to ‘ when you copy & paste.
I tried replacing but I still had errors.
Thanks for the link.
For better, quicker answers on T-SQL questions, click on the following...
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
February 13, 2012 at 1:24 pm
Please confirm that if I delete the Linked Server it will not Drop the Remote Login.
For better, quicker answers on T-SQL questions, click on the following...
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
February 13, 2012 at 7:55 am
Sorry I was not clear how about using NOT EQ.
For better, quicker answers on T-SQL questions, click on the following...
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
February 8, 2012 at 10:22 am
Viewing 15 posts - 1,786 through 1,800 (of 3,738 total)