2

My question is about this question asked before : How to create stored procedure in C#, then *save* it to SQL Server?

In every case in that question, how can I check, control or compile that sp? In this situation, I can create a sp that will not be compiled again from SQL server such as if table not exists?

1
  • 1
    I usually use SQL Server Management Studio (SSMS) which comes with SQL Server. I create my stored procedures in SSMS which has better error checking than if you do it in c#. You can save the stored procedures as a SSQL text file to reuse. Once the stored procedures are created you can then access then from c#. Commented Nov 23, 2016 at 12:29

1 Answer 1

2

You need to pass the error back to your program. Also, you cannot create same named procedures. You need to delete the old one first. Here's a list of ways with which you can do that.

Sql Server equivalent to Oracle's CREATE OR REPLACE VIEW

Pass this first, check for old procedure and delete it. Then create a new procedure.

Sign up to request clarification or add additional context in comments.

1 Comment

Check this question. Here, they need a error message and error code, which you can get from SqlCommand. I think you can implement one of these methods. stackoverflow.com/questions/7024109/…

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.