GeekInterview.com
Series: Subject: Topic:
Question: 3 of 45

stored procedures and functions

what is the difference between functions and stored procedures in sql server? what tool we are using in project management tool for developing packages in ssis? how to rectify the errors in stored procedure in sql server how many ways are there?
Asked by: Interview Candidate | Asked on: Jul 15th, 2011
Showing Answers 1 - 1 of 1 Answers

Functions

can be used with Select statement

Not returning output parameter but returns Table variables

You can join UDF

Can not be used to change server configuration

Can not be used with XML FOR clause

Can not have transaction within function



Stored Procedure

have to use EXEC or EXECUTE

return output parameter

can create table but wont return Table Variables

you can not join SP

can be used to change server configuration

can be used with XML FOR Clause

can have transaction within SP

SSIS Designer is a graphical tool for creating packages that includes separate tabbed design surfaces for building the control flow, data flow, and event handlers in packages.

Transact-SQL (T-SQL) stored procedures should be treated just like reusable application code. You should follow these suggested guidelines to ensure that your stored procedures are solid and robust: Check all parameters for valid values and return an error message if a problem exists.


Be sure that the parameter data types match the column data types they are compared against to avoid data type mismatches and poor query optimization.


Check the @@error system function after each SQL statement, especially insert, update, and delete, to verify that the statements executed successfully. Return a status code other than 0 if a failure occurs.


Be sure to comment your code so that when you or others have to maintain it, the code is self-documenting.


Consider using a source code management system, such as Microsoft Visual Studio SourceSafe, CVS, or Subversion, to maintain versions of your stored procedure source code.

  
Login to rate this answer.

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

Related Open Questions

Ads

Connect

twitter fb Linkedin GPlus RSS

Ads

Interview Question

 Ask Interview Question?

 

Latest Questions

Interview & Career Tips

Get invaluable Interview and Career Tips delivered directly to your inbox. Get your news alert set up today, Once you confirm your Email subscription, you will be able to download Job Inteview Questions Ebook . Please contact me if you there is any issue with the download.