Click here to Skip to main content
15,912,069 members
Home / Discussions / Database
   

Database

 
QuestionExplanation for the Query PLZZZZZ Pin
harsha_mec34517-Nov-08 18:39
harsha_mec34517-Nov-08 18:39 
AnswerRe: Explanation for the Query PLZZZZZ Pin
Muhammad Shahid Farooq17-Nov-08 19:15
professionalMuhammad Shahid Farooq17-Nov-08 19:15 
GeneralRe: Explanation for the Query PLZZZZZ Pin
harsha_mec34517-Nov-08 19:34
harsha_mec34517-Nov-08 19:34 
GeneralRe: Explanation for the Query PLZZZZZ Pin
Muhammad Shahid Farooq17-Nov-08 19:50
professionalMuhammad Shahid Farooq17-Nov-08 19:50 
QuestionTrigger a SQL Script to Run Based on a Column in Flat File Source In SSIS Pin
rangermutt17-Nov-08 9:47
rangermutt17-Nov-08 9:47 
AnswerRe: Trigger a SQL Script to Run Based on a Column in Flat File Source In SSIS Pin
Muhammad Shahid Farooq17-Nov-08 19:41
professionalMuhammad Shahid Farooq17-Nov-08 19:41 
QuestionHandling a SELECT in a stored procedure Pin
stormydaniels17-Nov-08 5:54
stormydaniels17-Nov-08 5:54 
AnswerRe: Handling a SELECT in a stored procedure Pin
Wendelius17-Nov-08 7:02
mentorWendelius17-Nov-08 7:02 
Few issues:
- define variables where you place the result from SELECT
- don't use parenthesis on parameters if creating a procedure but do use them if creating a function
- procedure cannot return a value, use output parameter or create a function.

Most likely you want to use a function for the logic you described. In that case it would be something like:
create function GetEventType (@EventID int)
returns varchar(12)
AS
declare @desc         varchar(50)  
declare @eventHeading varchar(12)  
begin  
   select @eventHeading = [EventHeading]
   from   tblEvents   
   where [EventID] = @EventID
   --
   set @desc = 'Unknown event type'
   if (@eventHeading = 'Info')  set @desc = 'Information'  
   if (@eventHeading = 'Warn')  set @desc = 'Warning'  
   if (@eventHeading = 'Error') set @desc = 'Error'		  
   ---
   return (@desc)
end


The need to optimize rises from a bad design.

My articles[^]

GeneralRe: Handling a SELECT in a stored procedure Pin
stormydaniels17-Nov-08 8:54
stormydaniels17-Nov-08 8:54 
GeneralRe: Handling a SELECT in a stored procedure Pin
Wendelius17-Nov-08 9:00
mentorWendelius17-Nov-08 9:00 
QuestionFileSystemObject Pin
topcatalpha17-Nov-08 2:30
topcatalpha17-Nov-08 2:30 
QuestionGet Max Pin
Zeyad Jalil16-Nov-08 22:37
professionalZeyad Jalil16-Nov-08 22:37 
AnswerRe: Get Max Pin
Wendelius17-Nov-08 4:50
mentorWendelius17-Nov-08 4:50 
AnswerRe: Get Max Pin
harsha_mec34517-Nov-08 18:32
harsha_mec34517-Nov-08 18:32 
Questionsp_cursoropen - does not return rowcount Pin
Krishnraj16-Nov-08 20:10
Krishnraj16-Nov-08 20:10 
AnswerRe: sp_cursoropen - does not return rowcount Pin
topcatalpha17-Nov-08 2:27
topcatalpha17-Nov-08 2:27 
GeneralRe: sp_cursoropen - does not return rowcount Pin
Krishnraj17-Nov-08 3:14
Krishnraj17-Nov-08 3:14 
AnswerRe: sp_cursoropen - does not return rowcount Pin
Wendelius17-Nov-08 4:47
mentorWendelius17-Nov-08 4:47 
GeneralRe: sp_cursoropen - does not return rowcount Pin
Krishnraj17-Nov-08 19:53
Krishnraj17-Nov-08 19:53 
GeneralRe: sp_cursoropen - does not return rowcount Pin
Wendelius18-Nov-08 4:52
mentorWendelius18-Nov-08 4:52 
GeneralRe: sp_cursoropen - does not return rowcount Pin
Krishnraj18-Nov-08 18:16
Krishnraj18-Nov-08 18:16 
GeneralRe: sp_cursoropen - does not return rowcount Pin
Wendelius19-Nov-08 4:11
mentorWendelius19-Nov-08 4:11 
QuestionDatabase Update issue Pin
AndieDu16-Nov-08 16:38
AndieDu16-Nov-08 16:38 
AnswerRe: Database Update issue Pin
Wendelius16-Nov-08 18:01
mentorWendelius16-Nov-08 18:01 
AnswerRe: Database Update issue Pin
Vimalsoft(Pty) Ltd17-Nov-08 20:05
professionalVimalsoft(Pty) Ltd17-Nov-08 20:05 

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.