Click here to Skip to main content
15,905,782 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Solved; it is copy right material thats why i removed it
Posted
Updated 17-Sep-13 22:12pm
v5

1 solution

I don't what your trying to do in this query. As far the error is concerned this could be solution. I am sure but give a try hope it works :). Split it into two different queries.

SQL
SELECT @CRIME_DETAIL_1=count(*) 
FROM t_crime_detail
  where RECORD_SYNC_FROM='PS'and PS_CD=@PS_CD
  and CONVERT(date, RECORD_CREATED_ON)=@REG_DT;

SELECT ( SELECT t_fir_registration.PS_CD FROM t_crime_detail INNER JOIN t_fir_registration ON t_crime_detail.FIR_REG_NUM=t_fir_registration.FIR_REG_NUM) AS PS_CD 
FROM t_crime_detail
 
  where RECORD_SYNC_FROM='PS'and PS_CD=@PS_CD
  and CONVERT(date, RECORD_CREATED_ON)=@REG_DT;
 
Share this answer
 
Comments
Shagun Bansal 18-Sep-13 2:44am    
thanks for reply actually first query doesnt have PS_CD, I want the list/Column of PS_CD which is return by ur second query,,
ArunRajendra 18-Sep-13 2:50am    
Yes. It will return the count as a output variable and 2nd query result as a dataset. That's what I told I don't know your requirement. If post the requirement we can refine the query.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900