Viewing 15 posts - 4,066 through 4,080 (of 4,085 total)
ps (7/29/2009)
select colA, colB, colC, colD=colA+colB+ colC from mytable where colD=123
I recommend that you TEST your solutions before posting, even for something apparently this simple. It helps no one...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
July 29, 2009 at 2:38 pm
Iron Chef SQL (7/29/2009)
I'm trying to figure out why but maybe it's something simple...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
July 29, 2009 at 2:28 pm
gyessql (7/29/2009)
If I dont want any fields from table2 then left join doesn't make a difference here, right?
Wrong. If the tables are in a one-to-one relationship then a left...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
July 29, 2009 at 2:17 pm
Why don't you use
IF Not Exists (
SELECT ct
FROM ironchef.dbo.war_conferenceregistrations
WHERE eventmeetingsetupid = @eventmeetingsetupid
)
This has the advantage that it will...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
July 28, 2009 at 9:36 pm
Providing enough information is key to getting the help you're requesting. Check out this article http://weblogs.sqlteam.com/jeffs/archive/2008/05/13/question-needed-not-answer.aspx
Drew
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
July 28, 2009 at 2:03 pm
Carefully reread Jack's response and you'll find the answer to your other question.
Drew
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
July 28, 2009 at 1:44 pm
Because SQL doesn't process the statements from the top to bottom. Check out this website for more information http://blog.sqlauthority.com/2009/04/06/sql-server-logical-query-processing-phases-order-of-statement-execution/. The WHERE clause is processed before the SELECT clause,...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
July 28, 2009 at 12:44 pm
I was thinking something similar, but I would add a Having clause like HAVING Min(IsNull(Column_Name,'') 'creation_date' OR Max(IsNull(Column_Name, '') 'last_modified_date' You may also want to specify the...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
July 28, 2009 at 12:35 pm
Another option SELECT Convert(Datetime, Replace('20Jul 15:46:1', ' ', '2009 '))
Drew
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
July 28, 2009 at 12:23 pm
First, you really should simplify your code. I struggled through what you were trying to accomplish with your statement. I figured out that this section CONVERT(DATETIME,STR(YEAR(CreateDate))+'-'+STR(MONTH(CreateDate))+'-'+STR(DAY(CreateDate))
+' '+STR(DATEPART(HOUR,CreateDate))+':'+STR(DATEPART(MINUTE,CreateDate))+
':'+STR(DATEPART(SECOND,CreateDate))) serves...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
July 28, 2009 at 12:09 pm
Well, you could use a CASE statement or a UDF, but you would need to use it in both your SELECT clause and the WHERE clause. Otherwise you're going...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
July 27, 2009 at 7:27 pm
You need to use the IIF(<Logical Expression>, <True Part>, <False Part>).
Also, I think that your false part can be greatly simplified by using the DateAdd() function. Try the following...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
July 27, 2009 at 1:33 pm
I did a Google search and quickly came up with a number of web pages that tell you how to do this. There is a third-party transformation, but that...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
July 26, 2009 at 6:42 pm
Your CASE statement is fine. The problem is in your PIVOT statement. You have PIVOT
(
MAX(fldTCN)
FOR fldTCN IN ([1.1],[2.2],[3.3],[4.4])
) AS Pvt
This gives you the max of the field that...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
July 26, 2009 at 9:37 am
I'm still learning MDX myself, so I'm not sure I can explain why it is necessary. I knew that you shouldn't be getting the exact same average for each...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
July 24, 2009 at 7:00 pm
Viewing 15 posts - 4,066 through 4,080 (of 4,085 total)