Click here to Skip to main content
15,896,111 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
SQL
set @sSQL='Insert into #tempBusDetails(Bus_Route_ID ,Bus_Route_Name ,Vehicle_No,Max_Occupacy,
                                       Current_Occupacy ,Driver_Name ,Driver_Mobile_No ,Assistant_Name ,Assistant_Mobile_No,Hub_ID,HTML_StopName)
              SELECT distinct(bd.Bus_Route_ID),bd.Bus_Route_Name, bd.Vehicle_No, bd.Max_Occupacy, dbo.Current_Count(bd.Bus_Route_ID) AS User_Count, bd.Driver_Name,
                   bd.Driver_Mobile_No,bd.Assistant_Name, bd.Assistant_Mobile_No, f.Facility_Name, dbo.fnc_CreateHTML_StopName(bd.Bus_Route_ID) AS HTML_StopName
              FROM dbo.tbl_Bus_Details AS bd
              INNER JOIN dbo.tbl_Facility AS f ON bd.Hub_ID = f.Facility_ID
              INNER JOIN dbo.tbl_stop_details as sd on sd.Bus_route_id=bd.bus_route_id
              WHERE bd.Inactive='+cast(@Inactive as varchar)+ ''


I have a doubt in the quotation mark(in the last line).

--> WHERE bd.Inactive='+cast(@Inactive as varchar)+ ''

-->is it like bd.Inactive=' (This quotation is end of start quote). If yes then why do we need the last two quotes(+ '').


-->or is it like this is wrapped in single quotes : '+cast(@Inactive as varchar)+ '. And the final quotation is closed for start quote.

Kindly guide me.
Posted

1 solution

Quote:
-->or is it like this is wrapped in single quotes : '+cast(@Inactive as varchar)+ '. And the final quotation is closed for start quote.

Yes, this one. :)
 
Share this answer
 
v2
Comments
anurag19289 11-Nov-13 10:03am    
Thanks for your response Tadit ji :) I have one doubt.

'select * from tbl_employee where first_name like'+ '''%tadit%'''

so in this case if we see
like'-->this is the end of first quote(unlike the above case)

And here first quote is start of second string. And the next two is behaving like single quote
'''%tadit%'''
And then next two quotes behaving as single quote. And the last one is close of second string.

Am i right ?
Yeah, correct.
anurag19289 11-Nov-13 11:42am    
Thanks you :)
Most welcome Anurag. :)

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