Different between Sp and inline query

Posted by Murugavelmsc under Interview Questions on 2/11/2013 | Points: 10 | Views : 884 | Status : [Member] | Replies : 3
Hi,

Different between Sp and Noraml select Query

Thanks,
Murugavel S

Regards,
Murugavel S
murugavel.sadagopan@gmail.com
http://murugavelmsc.blogspot.in/



Responses

Posted by: Satyapriyanayak on: 2/11/2013 [Member] [MVP] Silver | Points: 25

Up
0
Down
http://gregbeech.com/blog/inline-sql-vs-stored-procedures

If this post helps you mark it as answer
Thanks

Murugavelmsc, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sourabh_Mishra1 on: 2/11/2013 [Member] Starter | Points: 25

Up
0
Down
Hi,

When you are working as a Developer that time everything is depends on situations.
Here i am describe how these both are diffrent.
SP- Stored Procedures are created once in database and you just execute it with exec , u can use very easily. If you want any changes in ur query in SP u can change in ur database.

Inline query- When we are using inline queries. What happend lets see an example, suppose u have a 10 web forms and u wright ur inline query in all ur 10 webforms, after sometimes u think, u have to change the query or add some more parameters on that query, that time what u do , u open all 10 webpages and open the code and change the query. If ur query is very large that time, its a big hedeche for u how to change it. If you have essential to use inline query, always store ur queries with StringBuilder because its faster than string and with the use of Append Method u can easily understand ur inline queries.
For example-

StringBuilder _strQuery = new StringBuilder();
_strQuery.Append("SELECT EMPLOYEENAME, EMAIL, ADDRESS");
_strQuery.Append("FROM EMPLOYEE_MASTER");


Stored procedures are the best for the security resons, users can't access and see ur code of SP, but the use of SQL Injections anybody can see ur Inline query code.


Execution-
If i am talking about execution, So Stored procedures are Executed fast, because In inline queries compilerfirst understand ur query than send it to sql compiler than it understands it and than it will be executed.
Inline queries are not easy to understand some times when they are large queries.

For any more sugestion u can mail me on sourabh_mishra1@hotmail.com

Sourabh Mishra

Murugavelmsc, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Ankitsrist on: 2/11/2013 [Member] Starter | Points: 25

Up
0
Down
very nice explanation sourabh sir...

Murugavelmsc, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response