Click here to Skip to main content
15,895,084 members
Home / Discussions / Database
   

Database

 
GeneralTest data script Pin
Richard Parsons16-Feb-05 6:51
Richard Parsons16-Feb-05 6:51 
GeneralEDIT: SQL Guru challenge :) Or just a simple query question Pin
Richard Parsons16-Feb-05 7:27
Richard Parsons16-Feb-05 7:27 
GeneralRe: EDIT: SQL Guru challenge :) Or just a simple query question Pin
Michael Potter16-Feb-05 8:49
Michael Potter16-Feb-05 8:49 
GeneralRe: EDIT: SQL Guru challenge :) Or just a simple query question Pin
Richard Parsons16-Feb-05 11:34
Richard Parsons16-Feb-05 11:34 
GeneralRe: SQL Guru challenge :) Or just a simple query question Pin
NassosReyzidis10-Mar-05 1:11
NassosReyzidis10-Mar-05 1:11 
Generalprob in sp Pin
amalatsliit15-Feb-05 16:46
amalatsliit15-Feb-05 16:46 
GeneralRe: prob in sp Pin
Rob Graham16-Feb-05 15:59
Rob Graham16-Feb-05 15:59 
GeneralRe: prob in sp Pin
amalatsliit16-Feb-05 19:33
amalatsliit16-Feb-05 19:33 
Actually nice though.....Big Grin | :-D any way if u need my sp code here it is.but i guess thr is no prob in sp.any way it's upto u chk it and give me solution.D'Oh! | :doh:

SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO

/*AMAL FERNANDO ON 7 FEB 2005 */

ALTER PROC [USP_AEDMasterCode]
(@szCompCode VARCHAR(5),
@szMasterCode VARCHAR(5),
@szDesc VARCHAR(20),
@szCategory VARCHAR(10),
@szCategoryID VARCHAR(2),
@opType VARCHAR(6),
@type VARCHAR(6) OUTPUT,
@errDesc VARCHAR(20) OUTPUT)
AS


DECLARE @@dtLastLogin DATETIME
DECLARE @error INT
DECLARE @rowcount INT
DECLARE @errorMsg NVARCHAR(512)
DECLARE @spName SYSNAME

SELECT @error = @@error,
@rowcount = @@rowcount,
@spName = Object_Name(@@ProcID)

SET NOCOUNT ON
BEGIN TRAN

IF @opType = 'DELALL'
BEGIN
DELETE FROM [DBEPGlobal].[dbo].[EPG_tblMasterCodes]
SET @type = 'DELALL'
END
ELSE IF @opType = 'DEL'
BEGIN
DELETE FROM [DBEPGlobal].[dbo].[EPG_tblMasterCodes]
WHERE MC_szCompCode = @szCompCode
AND MC_szMasterCode = @szMasterCode
AND MC_szCategoryID = @szCategoryID
SET @type = 'DEL'
END
ELSE
IF EXISTS(SELECT * FROM EPG_tblMasterCodes
WHERE MC_szCompCode = @szCompCode
AND MC_szMasterCode = @szMasterCode
AND MC_szCategoryID = @szCategoryID)
BEGIN
UPDATE [DBEPGlobal].[dbo].[EPG_tblMasterCodes]
SET [MC_szCompCode] = @szCompCode,
[MC_szMasterCode] = @szMasterCode,
[MC_szDesc] = @szDesc,
[MC_szCategory] = @szCategory,
[MC_szCategoryID] = @szCategoryID
WHERE MC_szCompCode = @szCompCode
AND MC_szMasterCode = @szMasterCode
AND MC_szCategoryID = @szCategoryID
SET @type = 'UPDATE'
END
ELSE
BEGIN
INSERT INTO EPG_tblMasterCodes
(MC_szCompCode,
MC_szMasterCode,
MC_szDesc,
MC_szCategory,
MC_szCategoryID)
VALUES(@szCompCode,
@szMasterCode,
@szDesc,
@szCategory,
@szCategoryID)
SET @type = 'SAVE'
END

IF @@ERROR <> 0
BEGIN
ROLLBACK TRAN
RAISERROR('Error %d inserting into Region', 10, 1,@spName, @error,@errorMsg)
SET @errDesc = @error
RETURN(@error)
END
ELSE IF @rowcount <> 1
BEGIN
ROLLBACK TRAN
RAISERROR('Rowcount %d inserting into Region', 10, 1,@spName, @rowcount,@errorMsg)
WITH SETERROR
SET @errDesc = @@error
RETURN(@@error)
END
ELSE
BEGIN
COMMIT TRAN
RETURN(0)
END

GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO

ThanksConfused | :confused:
GeneralRe: prob in sp Pin
Mike Dimmick17-Feb-05 1:31
Mike Dimmick17-Feb-05 1:31 
GeneralRe: prob in sp Pin
amalatsliit17-Feb-05 16:01
amalatsliit17-Feb-05 16:01 
GeneralCasting error when passing a strongly typed dataset from a Webservice Pin
dazzler215-Feb-05 16:41
dazzler215-Feb-05 16:41 
GeneralRe: Casting error when passing a strongly typed dataset from a Webservice Pin
dazzler215-Feb-05 20:47
dazzler215-Feb-05 20:47 
Generalprob with sp return value Pin
amalatsliit15-Feb-05 15:55
amalatsliit15-Feb-05 15:55 
GeneralRe: prob with sp return value Pin
Scott Serl16-Feb-05 8:52
Scott Serl16-Feb-05 8:52 
GeneralRe: prob with sp return value Pin
amalatsliit16-Feb-05 15:17
amalatsliit16-Feb-05 15:17 
GeneralRe: prob with sp return value Pin
Scott Serl16-Feb-05 16:25
Scott Serl16-Feb-05 16:25 
GeneralRe: prob with sp return value Pin
amalatsliit16-Feb-05 19:25
amalatsliit16-Feb-05 19:25 
QuestionCould someone answer this? Pin
Tom Wright15-Feb-05 10:51
Tom Wright15-Feb-05 10:51 
AnswerRe: Could someone answer this? Pin
Rob Graham16-Feb-05 16:11
Rob Graham16-Feb-05 16:11 
GeneralRe: Could someone answer this? Pin
Tom Wright17-Feb-05 4:27
Tom Wright17-Feb-05 4:27 
GeneralRe: Could someone answer this? Pin
Rob Graham17-Feb-05 7:54
Rob Graham17-Feb-05 7:54 
GeneralRe: Could someone answer this? Pin
Tom Wright22-Feb-05 7:47
Tom Wright22-Feb-05 7:47 
GeneralADODB Record set Pin
HahnTech15-Feb-05 9:47
HahnTech15-Feb-05 9:47 
GeneralRe: ADODB Record set Pin
Anonymous16-Feb-05 11:46
Anonymous16-Feb-05 11:46 
GeneralData merge Pin
pedros7314-Feb-05 23:41
pedros7314-Feb-05 23:41 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.