Solved

BI Report - Understand Code

Posted on 2012-03-19
6
285 Views
Last Modified: 2012-03-20
Hi Experts,
I am new to BI Report and trying to understand some existing code.  In a SQL Statement it says @Date = 'ExpDate'. I know @Date is the parameter, but what does 'ExpDate' translate to?  I looked all the tables used in the scripts.  But did not see the field ExpDate.  Any idea?  Thank you very much in Advance.
0
Comment
Question by:RadhaKrishnaKiJaya
  • 3
  • 3
6 Comments
 
LVL 37

Expert Comment

by:ValentinoV
ID: 37741014
According to what you've mentioned, 'ExpDate' is the value of the @Date parameter.  Seems a bit weird though.  Perhaps there's an IF in front of it?

I can probably give you more info if you could post the whole statement though.
0
 

Author Comment

by:RadhaKrishnaKiJaya
ID: 37742876
Hi ValentinV
Thank you very much for you reply.  Here is the code below.  Please let me know.  Thank you.

Select * from TravelTransactions
Where  (@Date = 'ExpDate' and Exists (Select 1 from TravDetails where PNRNumber = @PNRNumber and TravelDate Between @StDate and @EnDate)
0
 
LVL 37

Expert Comment

by:ValentinoV
ID: 37743142
What is the definition of that @Date parameter?  Type, and Available values?  As far as I can tell, that query will only return data when the @Date parameter is set to 'ExpDate', so I would think that the type is Text and one of the available value is 'ExpDate'.
0
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

 

Author Comment

by:RadhaKrishnaKiJaya
ID: 37743206
@Date is a Date input field by the user.  The 'ExpDate' we are talking about, I don't see this in anywhere in the script.  So, how should I read 'ExpDate'?  Is this a memory varable or field in the Table or instant variable?  How shuld I read and reuse it if I need to?  Thank you.
0
 
LVL 37

Accepted Solution

by:
ValentinoV earned 500 total points
ID: 37743298
It's a hardcoded string in the query.  So if the parameter type is Date/Time then I don't see how that dataset can work...

Unless the single quotes shouldn't be there but that would mean there should be a column called ExpDate in the TravelTransactions table.
0
 

Author Closing Comment

by:RadhaKrishnaKiJaya
ID: 37743934
ValentinoV, That is the right answer.  I totally forgot about it.  The 'ExpDate' is hardcoded.  The @Date is a String parameter.  It looks confusing because of the naming.  Thank you very much again.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Pivot not using aggregate yield error 3 41
how to check the index used by a MS SQL queries or SP 7 37
sql query help 4 44
SQL Server - SQL field is defined as text 3 26
A recent questions about how to add SSRS named instances, couldn't find any that talks about SQL server 2008, anyway I decided to help by creating some screen shots. The installation is straightforward, you just pop the SQL server 2008 installati…
In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

930 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now