Click here to Skip to main content
15,911,896 members
Home / Discussions / Database
   

Database

 
QuestionDB Design Pin
monrobot138-Oct-06 14:44
monrobot138-Oct-06 14:44 
AnswerRe: DB Design Pin
i.j.russell9-Oct-06 0:09
i.j.russell9-Oct-06 0:09 
AnswerRe: DB Design Pin
Colin Angus Mackay9-Oct-06 3:30
Colin Angus Mackay9-Oct-06 3:30 
GeneralRe: DB Design Pin
monrobot139-Oct-06 8:12
monrobot139-Oct-06 8:12 
Questionwriting a stored procedure which makes multiple insertions-- need help Pin
Rocky#8-Oct-06 1:06
Rocky#8-Oct-06 1:06 
AnswerRe: writing a stored procedure which makes multiple insertions-- need help Pin
yahao8-Oct-06 11:37
yahao8-Oct-06 11:37 
GeneralRe: writing a stored procedure which makes multiple insertions-- need help Pin
Rocky#9-Oct-06 7:46
Rocky#9-Oct-06 7:46 
GeneralRe: writing a stored procedure which makes multiple insertions-- need help Pin
yahao9-Oct-06 23:14
yahao9-Oct-06 23:14 
hi!

I wrote sql server stored procedure since 2002,as a matter of experience,the best way to reduce bugs and errors is keep good habit for coding.

for example,code with EditPlus text-editor rather than sql server query analyzer,and use the syntax file & auto-completion for *.sql file type.

of course,one important factor is has clear structure of application,and then,produce high-quality code.Smile | :)

there is some code of mine:

/*
'##############################################################################
'## Copyright (C) 1998-2006 Yahao SoftWorks
'##
'## PROJ: FFS
'## SUBJ: get common present data
'##
'## Code by Yahao
'##############################################################################
'## C/U-Date: 2006-10-09
*/

-- Remove the existing Stored Procedure --
if (exists (select * from sysobjects where name = 'usp_m_getcPresentDetailData' and type = 'P'))
drop proc usp_m_getcPresentDetailData

go

CREATE PROCEDURE usp_m_getcPresentDetailData
(
---- In: op id ----
@inCmdID smallint,
---- In: obj id ----
@inOpItemID int,
---- In: obj name ----
@inOpItemName varchar(60),

---- Out: record amount ----
@otcPresentAmount int OUTPUT,

---- Ret ----
@ReturnValue int OUTPUT
)
WITH ENCRYPTION
AS

SET NOCOUNT ON

DECLARE @intRetValue As int,@intErrCode As int
DECLARE @intcPresentAmount As int

IF @@NESTLEVEL = 1
BEGIN
SET @ReturnValue = 99
RAISERROR ('illegal call',16, 1)
RETURN
END

---- var init ----
SET @intErrCode = 0
SET @intcPresentAmount = 0

---- RS1: present data ----
SELECT
PresentName,
StockAmount,
AvgStockPrice,
OptionSet,
CatID,
StockStatusTID,
Remark,
CreateOn,
Status
FROM onenb_shop.dbo.CommonPresentData
WHERE PresentID = @inOpItemID

---- return data ----
SET @otcPresentAmount = @intcPresentAmount

SET @ReturnValue = 0

SET NOCOUNT OFF
GeneralRe: writing a stored procedure which makes multiple insertions-- need help Pin
yahao9-Oct-06 23:32
yahao9-Oct-06 23:32 
Questionneed help in Stored procedure for inserting multiple records Pin
Rocky#7-Oct-06 9:17
Rocky#7-Oct-06 9:17 
AnswerRe: need help in Stored procedure for inserting multiple records Pin
Private_Void9-Oct-06 8:33
Private_Void9-Oct-06 8:33 
GeneralRe: need help in Stored procedure for inserting multiple records Pin
Rocky#12-Oct-06 7:52
Rocky#12-Oct-06 7:52 
Questionidentity with one column.... Pin
Amit Kumar G7-Oct-06 6:16
Amit Kumar G7-Oct-06 6:16 
AnswerRe: identity with one column.... Pin
Eric Dahlvang9-Oct-06 3:39
Eric Dahlvang9-Oct-06 3:39 
QuestionHow is this possible? Plz help...... Pin
deepak_rai7-Oct-06 4:36
deepak_rai7-Oct-06 4:36 
AnswerRe: How is this possible? Plz help...... Pin
yahao8-Oct-06 12:07
yahao8-Oct-06 12:07 
Questionhow can i get the deferent between tow dates Pin
ashraf hakiem7-Oct-06 1:59
ashraf hakiem7-Oct-06 1:59 
AnswerRe: how can i get the deferent between tow dates Pin
Rocky#8-Oct-06 1:12
Rocky#8-Oct-06 1:12 
QuestionReg. Connection Pooling Pin
aaraaayen6-Oct-06 20:11
aaraaayen6-Oct-06 20:11 
QuestionQuestion on existing syntax in sql statement Pin
leckey6-Oct-06 10:15
leckey6-Oct-06 10:15 
AnswerRe: Question on existing syntax in sql statement Pin
Mike Osbahr6-Oct-06 10:29
Mike Osbahr6-Oct-06 10:29 
GeneralSQL Server 2005 XML fun Pin
Private_Void6-Oct-06 9:25
Private_Void6-Oct-06 9:25 
Question"Transferring" SQL Server Databases Pin
Brendan Vogt6-Oct-06 2:06
Brendan Vogt6-Oct-06 2:06 
AnswerRe: "Transferring" SQL Server Databases Pin
Michael Potter6-Oct-06 5:39
Michael Potter6-Oct-06 5:39 
QuestionUsing trigger to insert data into seperate database. Pin
flippydeflippydebop5-Oct-06 23:24
flippydeflippydebop5-Oct-06 23:24 

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.