Reputation: 7053
I am trying to build a database using visual studio. But i saw that you can also use SQL server to do the job with stored procedures. Is it worth learning SQL server 2005 and stored procedures or can i code SQL straight to the sqlCommand when insert or select data?
Upvotes: -1
Views: 1268
Reputation: 4502
My understanding is that Stored Procedures ("sproc's") are often more efficient than the equivelent in-line SQL, because they are pre-optimized by the database engine.
Further, you can perform multiple actions with a stored procedure, and include conditional logic that is difficult to do effectively from in-line code.
In terms of implementing da logic, an sproc is a sensible place to do it. While you CAN accomplish many of the things you might want to do in-line, the database engine is specifically designed to perform certain types of operation very, very efficiently. Stored Procedures enable you to push the heavy lifting related to data access where it belongs (on the server) and keep your client code doing what IT is supposed to do. Namely, applying business ruiles to the use of the data.
I strongly recommend investing a little time learning your way around SQL Server Management Studios (SSMS) and the construction of Stored Procedures.
Upvotes: 1
Reputation: 107247
Either approach will work.
There is already a SO Post here discussion the benefits of either approach.
Given that you must already have some SQL DML knowledge, you can code inserts, selects and updates, why not go further and learn more. In my experience SQL has been the one language which has remained relatively constant throughout my career.
Upvotes: 2
Reputation: 101
I believe learning stored procedures is a valuable skill. I've seen developers write hundreds of lines of code when to do data manipulations that would have been simple to express in a SQL statement and ran as a stored procedure.
Upvotes: 1
Reputation: 6637
Using Stored Procedure in contrast of inline query is a better option in most of the cases. And if you want to make application that uses a database, it is important for you to have hands on Store procedures and atleast some understanding of SQL Server. Hope I answer your question.
Upvotes: 0
Reputation: 22076
It is better to learn new things. So you must learn SQL Server and STORED PROCEDURE because writing stored procedure is must to learn for a programmer.
Upvotes: 3