|
SoftTree Technologies
Technical Support Forums
|
|
Author |
Message |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7929
|
|
_WOW_2 snippet for generating table wrapper procs (MSSQL) |
|
|
|
USE [$DB$]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Created By: $OSUSER$
-- Created Date: $DATE$ $TIME$
-- Description: Update procedure for table $OBJECT$
-- Table primary key must be an identity column
--
-- Modified By:
-- Modified Date:
-- Comments:
-- =============================================
CREATE PROCEDURE [dbo].[usp$OBJECT$_Update_By$COLUMN_KEYS$]
(
@$COLUMNS+TYPES_V$=NULL
)
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
IF @$COLUMN_KEYS_V$ < 1
BEGIN
INSERT INTO $OBJECT$
(
$COLUMNS_V$
)
VALUES
(
@$COLUMNS_V$
)
SELECT SCOPE_IDENTITY() $COLUMN_KEYS_V$
END
ELSE
BEGIN
UPDATE $OBJECT$ SET
$COLUMNS_V$ = @$COLUMNS_V$
WHERE $COLUMN_KEYS_V$ = @$COLUMN_KEYS_V$
SELECT @$COLUMN_KEYS_V$ $COLUMN_KEYS_V$
END
END |
|
|
Fri Jul 01, 2011 12:43 pm |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|