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

Database

 
GeneralRe: Schema Question Pin
Paul Unsworth6-Jul-09 21:42
Paul Unsworth6-Jul-09 21:42 
GeneralRe: Schema Question Pin
David Mujica7-Jul-09 2:57
David Mujica7-Jul-09 2:57 
GeneralRe: Schema Question Pin
Paul Unsworth7-Jul-09 3:14
Paul Unsworth7-Jul-09 3:14 
GeneralAlong with security, consider auditing Pin
David Mujica7-Jul-09 3:25
David Mujica7-Jul-09 3:25 
GeneralRe: Along with security, consider auditing Pin
Paul Unsworth7-Jul-09 4:28
Paul Unsworth7-Jul-09 4:28 
QuestionIF else or Case when Pin
Vimalsoft(Pty) Ltd6-Jul-09 2:34
professionalVimalsoft(Pty) Ltd6-Jul-09 2:34 
AnswerRe: IF else or Case when Pin
DoctorMick6-Jul-09 6:28
DoctorMick6-Jul-09 6:28 
GeneralRe: IF else or Case when Pin
Vimalsoft(Pty) Ltd6-Jul-09 19:58
professionalVimalsoft(Pty) Ltd6-Jul-09 19:58 
Good Morning

i have changed it to this and it works


ALTER PROC [dbo].[sp_Get_Staff_Cycles]  
(
@Subject_Descr varchar(30)
)
AS
--Check if the table Exists 
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[FINAL]'))
drop table [FINAL]
--Get the Cycle template description
Declare @CycletemplateTerm varchar(60)
set @CycletemplateTerm = (  select top 1 t.descr from MTM_ACTV_STAFF mtn
							inner join tbl_actv a on a.id  = MTN.actv
							inner join tbl_cntc cc on a.cntcID = cc.id
							inner join tbl_modl m on m.id = cc.modlid
							inner join tbl_term t on a.term = t.id 
							LEFT OUTER JOIN MTM_ACTV_STAFF_CYCLE C
							ON C.IDL = MTN.ID
							WHERE M.DESCR = @Subject_Descr
						)
 
SELECT [ID] = IDENTITY (int,1,1),A.DESCR AS [ACTIVITY], S.DESCR,
CASE
WHEN MTN.CYCLETEMPLATE IS NULL THEN  C.CYCLES
WHEN MTN.CYCLETEMPLATE IS NOT NULL THEN @CycletemplateTerm 
END AS CYCLETEMPLATE
INTO FINAL FROM TBL_STAFF S
INNER JOIN MTM_ACTV_STAFF MTN ON
S.ID = MTN.STAFF
inner join tbl_actv a on a.id  = MTN.actv
inner join tbl_cntc cc on a.cntcID = cc.id
inner join tbl_modl m on m.id = cc.modlid
LEFT OUTER JOIN MTM_ACTV_STAFF_CYCLE C
ON C.IDL = MTN.ID
WHERE M.DESCR = @Subject_Descr


Thank you

Vuyiswa Maseko,

Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers."

C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.somee.com
http://www.vuyiswamaseko.tiyaneProperties.co.za
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/

QuestionSelect null value Pin
yesu prakash6-Jul-09 2:20
yesu prakash6-Jul-09 2:20 
AnswerRe: Select null value Pin
Eddy Vluggen6-Jul-09 3:28
professionalEddy Vluggen6-Jul-09 3:28 
AnswerRe: Select null value Pin
Niladri_Biswas6-Jul-09 15:51
Niladri_Biswas6-Jul-09 15:51 
QuestionSQL Stored Procedure INSERT with random records from a 2nd table [modified] Pin
munklefish6-Jul-09 0:46
munklefish6-Jul-09 0:46 
AnswerRe: SQL Stored Procedure INSERT with random records from a 2nd table Pin
DoctorMick6-Jul-09 1:05
DoctorMick6-Jul-09 1:05 
GeneralRe: SQL Stored Procedure INSERT with random records from a 2nd table Pin
munklefish6-Jul-09 1:09
munklefish6-Jul-09 1:09 
GeneralRe: SQL Stored Procedure INSERT with random records from a 2nd table Pin
Blue_Boy6-Jul-09 6:11
Blue_Boy6-Jul-09 6:11 
GeneralRe: SQL Stored Procedure INSERT with random records from a 2nd table Pin
munklefish7-Jul-09 0:04
munklefish7-Jul-09 0:04 
Questioni neeed help Pin
mahmoudinirat5-Jul-09 23:32
mahmoudinirat5-Jul-09 23:32 
AnswerRe: i neeed help Pin
DoctorMick6-Jul-09 0:00
DoctorMick6-Jul-09 0:00 
QuestionWant to understand how to fine tune stored procedure in SQL Server 2005? Pin
Sasmi_Office5-Jul-09 20:12
Sasmi_Office5-Jul-09 20:12 
AnswerRe: Want to understand how to fine tune stored procedure in SQL Server 2005? Pin
Blue_Boy5-Jul-09 22:10
Blue_Boy5-Jul-09 22:10 
QuestionTime Difference w.r.t Dates Pin
AliAmjad5-Jul-09 19:37
AliAmjad5-Jul-09 19:37 
AnswerRe: Time Difference w.r.t Dates Pin
Blue_Boy5-Jul-09 20:41
Blue_Boy5-Jul-09 20:41 
GeneralRe: Time Difference w.r.t Dates Pin
AliAmjad5-Jul-09 21:01
AliAmjad5-Jul-09 21:01 
GeneralRe: Time Difference w.r.t Dates Pin
Blue_Boy5-Jul-09 21:39
Blue_Boy5-Jul-09 21:39 
GeneralRe: Time Difference w.r.t Dates Pin
AliAmjad5-Jul-09 21:54
AliAmjad5-Jul-09 21:54 

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.