Click here to Skip to main content
15,896,269 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Please do explain me with example, i refereed to many websites but i am unable get the exact difference.
Posted
Updated 27-Oct-15 2:25am
v2

SQL is a language that lets you express queries. A stored procedure is a database entity that contains SQL and allows the SQL to be executed by executing the Stored Procedure. Think of SQL like c# and Stored Procs like methods in your code.

However you probably really meant to ask the difference between dynamic SQL and stored procedures. Dynamic SQL is when you create SQL on the fly and execute it against the database engine, whereas with a stored proc the SQL is fixed to whatever is in the SP.
 
Share this answer
 
v2
Comments
Sergey Alexandrovich Kryukov 27-Oct-15 9:21am    
How can you seriously answer the question which makes no sense at all? It's like "what's the difference between traffic and steering wheel?" :-)
—SA
F-ES Sitecore 27-Oct-15 9:27am    
Because I'm that good :)
Sergey Alexandrovich Kryukov 27-Oct-15 9:43am    
All right, good for you, the question is what increases or decreases the total amount of evil in the world. :-)
Maybe by answering, instead of commenting, you encourage the ignorance.
—SA
stored procedure is like function call,

there are n number of queries u may use in your work.. You just define (or) stored in a form..

For example .. The following is just a idea,not exact syntax..

SQL
1.select * from tbl_table
2.select a.a_id,b.name from tbl_a as a inner join tbl_b as  b on a.a_id=b.a_id
3.select a_id from tbl_a where a_id=@a_id

The above are query..

In ur wrk u write each time
Forms in c# by Query


form-1
{
string query="select * from tbl_table" ;
--------
----
---
string query="select * from tbl_table" ;

---------
------
string query="select a.a_id,b.name from tbl_a as a inner join tbl_b as  b on a.a_id=b.a_id" ;
----
}
form-2
{


---------
------
string query="select a.a_id,b.name from tbl_a as a inner join tbl_b as  b on a.a_id=b.a_id" ;
}


So we have to go with stored procedure we just define

value=1 is select * from tbl_table

value=2 is select a.a_id,b.name from tbl_a as a inner join tbl_b as b on a.a_id=b.a_id
value=3 is select a_id from tbl_a where a_id=@a_id


Now we just call defined at wherever we need

Forms in c# by Stored Procedure


form-1
{
commandType=storedprocedure;
value=1
.........
value=2
....
value=3
.....
value=1..

}
Form-2

{
value=3
.....
}


For each form u may tired on writing query ,Wherever u need just take from the procedure which was stored by u...


Its not a perfect syntax just an Idea not exact syntax
 
Share this answer
 
v2

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