About 477,000 results
Open links in new tab
  1. SQL Server: how to create a stored procedure - Stack Overflow

    CREATE PROCEDURE dept_count ( -- Add input and output parameters for the stored procedure here @dept_name varchar(20), --Input parameter @d_count int OUTPUT -- Output parameter declared with the help of OUTPUT/OUT keyword ) AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from -- interfering with SELECT statements.

  2. sql server - t-sql stored procedure create scripts - Stack Overflow

    Update: if you want to do this in the SQL Server Management Studio app, you can use this SQL script to find the stored procs and their definitions - you cannot however have SQL Server Mgmt Studio write out the files to disk, that doesn't work - but you can copy the results into e.g. Excel.

  3. Creating a stored procedure if it does not already exist

    Apr 9, 2014 · One idiom that I've been using lately that I like quite a lot is: if exists (select 1 from sys.objects where object_id = object_id('dbo.yourProc')) set noexec on go create procedure dbo.yourProc as begin select 1 as [not yet implemented] end go set noexec off alter procedure dbo.yourProc as begin /*body of procedure here*/ end

  4. How to update a table using stored procedures in SQL Server

    I have created a table in SQL Server called "Employee", and now I want to update the table using a stored procedure. The table has emp_name, emp_code and status columns. Assume the table has three records: initially, in the stored procedure I want to fetch the last two records using a select statement and I have to the fetched records' status ...

  5. Microsoft SQL Server - Who created a Stored Procedure?

    Nov 19, 2009 · These scripts create a table in your admin DB (SQL_DBA for me), create a trigger on the model db, create triggers on existing databases. I also created a sp_msforeachDB statement at the end to disable all of them.

  6. sql - Create Procedure Permission ONLY - Stack Overflow

    I have a requirement in SQL Server 2008 in development database. Only DBA's ( who are database owners ) can create, alter tables . Developer's should not create or alter tables . Developers can create/alter Stored Procedure/User Defined functions in dbo schema and can execute SP/UDF.

  7. sql - Creating a View using stored procedure - Stack Overflow

    Oct 10, 2011 · I use the following dynamic SQL code in my SQL database to create a view with a store procedure. It works fine: CREATE PROCEDURE uspCreateView AS EXEC (' CREATE VIEW vwDataLayoutFileAssignment AS SELECT b.FileID, d.FieldID FROM [File] b, DataLayoutFileAssignment c, [Field] d WHERE b.DriverFileID = c.FileID AND C.DataLayoutID = d.DataLayoutID ')

  8. drop and create SQL Server procedure - Stack Overflow

    Jun 22, 2011 · The sqlcmd utility lets you enter Transact-SQL statements, system procedures, and script files at the command prompt, in Query Editor in SQLCMD mode, in a Windows script file or in an operating system (Cmd.exe) job step of a SQL Server Agent job.

  9. sql - What is a stored procedure? - Stack Overflow

    Stored procedures in SQL Server can accept input parameters and return multiple values of output parameters; in SQL Server, stored procedures program statements to perform operations in the database and return a status value to a calling procedure or batch. The benefits of using stored procedures in SQL Server. They allow modular programming.

  10. sql server - Temporary tables in stored procedures - Stack Overflow

    May 13, 2009 · Also keep in mind that you can't rely on a try/catch to force a cleanup within the stored procedure. certain types of failures cannot be caught within a try/catch (e.g. compile failures due to delayed name resolution) if you want to be really certain you may need to create a wrapper stored procedure that can do a try/catch of the worker stored ...

Refresh