TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
anad aramandla
NA
3
1.8k
SQL
Jul 2 2011 3:55 AM
Hi pls help for below query,how to write the sp in sql. when i try i am getting syntax error.
function getCorruptFilesList($file_date,$account_id=NULL,$client_id=NULL) - Start Here
{
$account_id_condition = ($account_id)?' AND cca.account_id = '.$account_id:NULL;
$client_id_condition = ($client_id)?' AND cca.client_id = '.$client_id:NULL;
$query="SELECT cca.account_id, cca.account_name, avf.file_name , CASE WHEN avf.is_corrupt IS TRUE THEN 'Corrupted'::text WHEN avf.is_notrequired IS TRUE THEN 'Not Required'::text END AS status , vvc.company_name as vendor FROM admin.voice_filedetails avf JOIN admin.voice_filetrans avt ON avf.file_id = avt.file_id AND avt.thead_id IN (1,2,4) JOIN client.client_accounts cca USING(account_id) LEFT JOIN vendor.vendor_contacts vvc ON vvc.vendor_id = avt.vendor_id WHERE avf.file_date = '".$file_date."' ".$client_id_condition.$account_id_condition." AND (avf.is_corrupt = 'TRUE' OR avf.is_notrequired ='TRUE') ORDER BY cca.account_name ";
$arr = $this->returnQueryArray($query);
return $arr;
Reply
Answers (
1
)
Dynamic Sql "SET IDENTITY_INSERT [Table] ON/OFF" problem
Stored Procedure