Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
sfjtraps
Yak Posting Veteran
65 Posts |
Posted - 2009-09-22 : 13:45:32
|
I'm trying understand the following part of a stored procedure and the term ColorCode in the procedure. I don't see ColorCode in the rest of the stored procedure, so I was wondering if ColorCode is a T-SQL command. I'm using the stored procedure as part of a SQL report and I'm trying to understand what is populating ColorCode.Any help would be greatly appreciated.-----------------------------------------------------------EXEC ('SELECT StartDateTime, SystemName, CASE WHEN CategoryName IS NULL OR CategoryName = '''' THEN ''Not Defined'' ELSE CategoryName END AS CategoryName, CASE WHEN StartDateTime >= '''+@StartDateTime+''' AND EndDateTime <= '''+ @EndDateTime +''' THEN DATEDIFF(ss,StartDateTime,EndDateTime) WHEN StartDateTime >= '''+@StartDateTime+''' AND EndDateTime > '''+ @EndDateTime +''' THEN DATEDIFF(ss,StartDateTime,'''+ @EndDateTime +''') WHEN StartDateTime < '''+@StartDateTime+''' AND EndDateTime <= '''+ @EndDateTime +''' THEN DATEDIFF(ss,'''+ @StartDateTime +''',EndDateTime) WHEN StartDateTime < '''+@StartDateTime+''' AND EndDateTime > '''+ @EndDateTime +''' THEN DATEDIFF(ss,'''+ @StartDateTime +''','''+ @EndDateTime +''') END AS Duration , CASE WHEN ColorCode IS NULL THEN ''Black'' ELSE ColorCode END AS ColorCode FROM [table] WHERE ((StartDateTime >= '''+@StartDateTime+''' AND StartDateTime < '''+ @EndDateTime +''') OR (EndDateTime > '''+@StartDateTime+''' AND EndDateTime <= '''+ @EndDateTime +''') OR (StartDateTime < '''+@StartDateTime+''' AND EndDateTime > '''+ @EndDateTime +''')) '+ @WhereClause +' ORDER BY SystemName,StartDateTime') |
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
sfjtraps
Yak Posting Veteran
65 Posts |
Posted - 2009-09-22 : 14:55:56
|
I guess I'm confused because I don't know where my table is. Is this a temporary table? |
 |
|
TG
Master Smack Fu Yak Hacker
6065 Posts |
Posted - 2009-09-22 : 15:01:48
|
Looks like it is a VIEW (based on the name). Look in the server's object explorer under "views"Be One with the OptimizerTG |
 |
|
sfjtraps
Yak Posting Veteran
65 Posts |
Posted - 2009-09-22 : 15:03:27
|
I understand now! Thank you! |
 |
|
|
|
|
|
|