Click here to Skip to main content
15,917,062 members
Home / Discussions / Database
   

Database

 
GeneralRe: Problem with query Pin
gregarion9-Feb-10 2:59
gregarion9-Feb-10 2:59 
QuestionAccess 2007 calculation query Pin
Dalek Dave9-Feb-10 1:26
professionalDalek Dave9-Feb-10 1:26 
AnswerRe: Access 2007 calculation query Pin
loyal ginger9-Feb-10 3:03
loyal ginger9-Feb-10 3:03 
GeneralRe: Access 2007 calculation query Pin
Dalek Dave9-Feb-10 3:28
professionalDalek Dave9-Feb-10 3:28 
AnswerRe: Access 2007 calculation query Pin
David Mujica9-Feb-10 3:06
David Mujica9-Feb-10 3:06 
GeneralRe: Access 2007 calculation query Pin
Dalek Dave9-Feb-10 3:29
professionalDalek Dave9-Feb-10 3:29 
AnswerRe: Access 2007 calculation query Pin
Avi Berger9-Feb-10 6:30
Avi Berger9-Feb-10 6:30 
QuestionIncoporate the UDF functionality into the Sp Pin
Vimalsoft(Pty) Ltd9-Feb-10 0:28
professionalVimalsoft(Pty) Ltd9-Feb-10 0:28 
Good Day All

I have an Sp and UDF. the UDF cant take #tables. so i want to incoporate the functionality that is being provided by the udf and make it part of the code. the first part of my statement creates a solid table that is being used in the UDF

truncate table temp
INSERT INTO temp 
SELECT MTN.ID,S.DESCR,ISNULL(MTN.CYCLETEMPLATE,C.CYCLES) AS CYCLETEMPLATE,MTN.ACTV AS [ACTV]
FROM TBL_STAFF S
INNER JOIN MTM_ACTV_STAFF MTN ON
S.ID = MTN.STAFF
LEFT OUTER JOIN MTM_ACTV_STAFF_CYCLE C
ON C.IDL = MTN.ID
END 
ELSE
BEGIN 
SELECT MTN.ID,S.DESCR,ISNULL(MTN.CYCLETEMPLATE,C.CYCLES) AS CYCLETEMPLATE,MTN.ACTV AS [ACTV]
into temp
FROM TBL_STAFF S
INNER JOIN MTM_ACTV_STAFF MTN ON
S.ID = MTN.STAFF
LEFT OUTER JOIN MTM_ACTV_STAFF_CYCLE C
ON C.IDL = MTN.ID
END 


and later in my Sp i have this line of statement

SELECT DESCR, dbo.GetSortedString(Cast(NULL AS varchar(8000))) AS CycleIdList,ACTV
INTO #TempSummary
FROM temp (NOLOCK)
GROUP BY DESCR,ACTV
ORDER BY DESCR,ACTV


which has no problem and later i want to update the Filed in the #TempSummary table like this

UPDATE #TempSummary
SET CycleIdList = dbo.Concat(#TempSummary.Descr,#TempSummary.actv)



now the problem is here, the Concat is the UDF. defined like this



create FUNCTION [dbo].[Concat] (@Name varchar(50),@Actv int)
RETURNS varchar(max)
WITH EXECUTE AS CALLER
AS
BEGIN
Declare @s varchar(max)
SET @s = ''

SELECT @s = @s + IsNull(',' + Cast(Cycletemplate AS varchar), '')
FROM temp (NOLOCK)
WHERE temp.Descr = @Name And temp.Actv = @Actv
GROUP BY Cycletemplate
ORDER BY Cycletemplate
IF (@S IS NOT NULL) AND (@S <> '') SET @S = SubString(@s, 2, Len(@S)-1)
RETURN @S
END



now i want to incoporate the functionality of the UDF and get rid of it. The UDF use the Temp created in the First example code based on the two fields. and generate the string and update the table #TempSummary. How can i incoporate this functionlity without using UDF.

Thanks
Vuyiswa Maseko,

Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.

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

QuestionOracle View Schema Pin
Ahmad Safwat8-Feb-10 6:31
Ahmad Safwat8-Feb-10 6:31 
QuestionA newbie to MySql Pin
Alan Kurlansky8-Feb-10 3:19
Alan Kurlansky8-Feb-10 3:19 
AnswerRe: A newbie to MySql Pin
Eddy Vluggen8-Feb-10 7:22
professionalEddy Vluggen8-Feb-10 7:22 
QuestionQuery help Pin
sarang_k7-Feb-10 19:52
sarang_k7-Feb-10 19:52 
AnswerRe: Query help Pin
Not Active7-Feb-10 20:08
mentorNot Active7-Feb-10 20:08 
AnswerRe: Query help Pin
Andy_L_J7-Feb-10 20:42
Andy_L_J7-Feb-10 20:42 
AnswerRe: Query help Pin
Md. Marufuzzaman8-Feb-10 0:05
professionalMd. Marufuzzaman8-Feb-10 0:05 
QuestionStoring multipe datatypes in single sql server table column.. Pin
Member 41254807-Feb-10 17:08
Member 41254807-Feb-10 17:08 
AnswerRe: Storing multipe datatypes in single sql server table column.. Pin
Not Active7-Feb-10 18:24
mentorNot Active7-Feb-10 18:24 
GeneralRe: Storing multipe datatypes in single sql server table column.. Pin
Member 41254808-Feb-10 18:50
Member 41254808-Feb-10 18:50 
AnswerRe: Storing multipe datatypes in single sql server table column.. [modified] Pin
Luc Pattyn8-Feb-10 1:31
sitebuilderLuc Pattyn8-Feb-10 1:31 
AnswerRe: Storing multipe datatypes in single sql server table column.. Pin
Eddy Vluggen8-Feb-10 2:33
professionalEddy Vluggen8-Feb-10 2:33 
QuestionMerging server database with portable database Pin
Eli Nurman7-Feb-10 10:40
Eli Nurman7-Feb-10 10:40 
AnswerRe: Merging server database with portable database Pin
Not Active7-Feb-10 12:09
mentorNot Active7-Feb-10 12:09 
QuestionNeed A MSSQL Trigger Pin
idumlupinar7-Feb-10 2:18
idumlupinar7-Feb-10 2:18 
AnswerRe: Need A MSSQL Trigger Pin
Not Active7-Feb-10 2:48
mentorNot Active7-Feb-10 2:48 
GeneralRe: Need A MSSQL Trigger Pin
idumlupinar7-Feb-10 2:54
idumlupinar7-Feb-10 2: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.