» What are the pros and cons to keeping SQL in Stored Procs versus Code
What are the pros and cons to keeping SQL in Stored Procs versus Code
|August 18, 2008
Posted by forumadmin
What are the advantages/disadvantages of keeping SQL in your C# source code or in Stored Procs? I’ve been discussing this with a friend on an open source project that we’re working on (C# ASP.NET Forum). At the moment, most of the database access is done by building the SQL inline in C# and calling to the SQL Server DB. So I’m trying to establish which, for this particular project, would be best.
So far I have:
Advantages for in Code:
- Easier to maintain – don’t need to run a SQL script to update queries
- Easier to port to another DB – no procs to port
Advantages for Stored Procs:
More Related Questions
- MSSQL: How do you script Stored Procedure creation with code? I am trying to query for a list of stored procedure definitions using information_schema.routines that exist in one database but not in another.
- Function vs. Stored Procedure in SQL Server I've been learning Functions and Stored Procedure for quite a while but I don't know why and when I should use a function or a stored procedure. They look same to me, maybe because I am […]
- How to SELECT * INTO [temp table] FROM [stored procedure] How do I do a SELECT * INTO [temp table] FROM [stored procedure]? Not FROM [Table] and without defining [temp table]?
Select all data from BusinessLine into tmpBusLine works fine.
- Jsp & stored procedures I issue SP from Jsp, code is here:
sql = "EXEC REP_INVOICES ?,?";
java.sql.PreparedStatement ps = cox.prepareStatement(sql);
- SQL Server: select only if nested select returns something I am trying to set the following query so that it only selects any data from the DaysMov table (A) if the nested Select finds a matching date in the Calendar table (B).
Currently in such […]
- how to deal with "Maximum stored procedure, function, trigger, or view nesting level exceeded (limit 32)." i was asked to Create script that will expect whoever runs it to provide an employee id. Locate all employees that the provided employee supervises in any depth.
My code is :
- Alternatives to SQL Where Condition with OR What is a more efficient alternative to using the OR condition in the where clause?
x.col1 = y.col1,
x.col2 = y.col2,
x.col3 = y.col3,
x.col4 = y.col4
- select max date and min date Have table like :
user_id Date Status
1000 2013-04-02 11:46:10.000 IN
1001 2013-04-02 11:50:08.000 OUT
- Combining rows of queried results by unique identifier?(Resolved) I have a query that searches through several tables and returns one row for every value in one specific column of one of the queried tables. The table returns multiple rows for one unique […]
- merging records for sql table based on column data i have some dirty resource usage records in t_resourcetable which looks like this
resNo subres startdate enddate
1 2 2012-01-02 22:03:00.000 […]