Click here to Skip to main content
15,914,608 members
Home / Discussions / Database
   

Database

 
QuestionRestrict showdialog only to the parent window ? [modified] Pin
fracalifa9-Feb-10 21:27
fracalifa9-Feb-10 21:27 
AnswerRe: Restrict showdialog only to the parent window ? Pin
J4amieC9-Feb-10 21:45
J4amieC9-Feb-10 21:45 
GeneralRe: Restrict showdialog only to the parent window ? Pin
fracalifa9-Feb-10 21:48
fracalifa9-Feb-10 21:48 
QuestionDB Backup Sql query Pin
Sivaooty9-Feb-10 19:58
Sivaooty9-Feb-10 19:58 
AnswerRe: DB Backup Sql query Pin
Md. Marufuzzaman10-Feb-10 3:54
professionalMd. Marufuzzaman10-Feb-10 3:54 
QuestionHelp with this SQl Logic without using UDF Pin
Vimalsoft(Pty) Ltd9-Feb-10 4:14
professionalVimalsoft(Pty) Ltd9-Feb-10 4:14 
AnswerRe: Help with this SQl Logic without using UDF Pin
Not Active9-Feb-10 5:52
mentorNot Active9-Feb-10 5:52 
GeneralRe: Help with this SQl Logic without using UDF Pin
Vimalsoft(Pty) Ltd9-Feb-10 19:41
professionalVimalsoft(Pty) Ltd9-Feb-10 19:41 
Thank you guys, The Common Table Expression was slow , i found a Solution and i wrote it this way


SELECT DESCR,ACTV,[CYCLETEMPLATE] = STUFF((SELECT ',' + CAST(CYCLETEMPLATE AS VARCHAR(MAX))
				    FROM #temp
					WHERE DESCR = t.DESCR
					AND ACTV = t.ACTV 
					FOR XML PATH('')),1,1,'') 
into #TempSummary   FROM #temp t
GROUP BY DESCR,ACTV


now i want to sort the CYCLETEMPLATE. I have this UDF

ALTER FUNCTION [dbo].[GetSortedString]
(
 @inputString varchar(max)
)
RETURNS varchar(max)
AS
BEGIN
 
if dbo.IsStringNumeric( @inputString) = 1
 begin
  return dbo.GetSortedStringNumeric( @inputString)
 end

return @inputString --dbo.GetSortedStringNormal(@inputString)

END


and

ALTER  FUNCTION [dbo].[GetSortedStringNumeric]
(
 @inputString varchar(max)
)
RETURNS varchar(max)
AS
BEGIN
 
declare @outputString varchar(max)
set @outputString = ''
select @outputString = ltrim(rtrim(str(item))) + ','  + @outputString  from dbo.fnSplit(@inputString,',') order by item desc
 declare @Results int 
 set @Results = (select dbo.IsMatching(@outputString,'[A-Z ]'))

if  SUBSTRING(@outputString,len(@outputString),1) = ',' AND @Results = 0
 begin
  set @outputString = SUBSTRING(@outputString,1,len(@outputString)-1) 
 end
else if SUBSTRING(@outputString,len(@outputString),1) = ',' AND @Results > 1
begin
return @outputString 
end
return @outputString

END


if i don't sort its Faster but if i sort its a little bit slower. This is how i incoporate it in my query. i just Build a Temp table and sort it there.


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


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/

GeneralRe: Help with this SQl Logic without using UDF Pin
nainakarri10-Feb-10 17:55
nainakarri10-Feb-10 17:55 
GeneralRe: Help with this SQl Logic without using UDF Pin
Vimalsoft(Pty) Ltd10-Feb-10 19:35
professionalVimalsoft(Pty) Ltd10-Feb-10 19:35 
GeneralRe: Help with this SQl Logic without using UDF Pin
Mycroft Holmes10-Feb-10 20:02
professionalMycroft Holmes10-Feb-10 20:02 
GeneralRe: Help with this SQl Logic without using UDF Pin
Vimalsoft(Pty) Ltd10-Feb-10 20:06
professionalVimalsoft(Pty) Ltd10-Feb-10 20:06 
AnswerRe: Help with this SQl Logic without using UDF Pin
Mycroft Holmes9-Feb-10 13:38
professionalMycroft Holmes9-Feb-10 13:38 
QuestionReading variables in Insert Query Pin
gregarion9-Feb-10 2:47
gregarion9-Feb-10 2:47 
AnswerRe: Reading variables in Insert Query Pin
loyal ginger9-Feb-10 2:54
loyal ginger9-Feb-10 2:54 
GeneralRe: Reading variables in Insert Query Pin
gregarion9-Feb-10 2:58
gregarion9-Feb-10 2:58 
GeneralRe: Reading variables in Insert Query Pin
Maximilien9-Feb-10 4:18
Maximilien9-Feb-10 4:18 
GeneralRe: Reading variables in Insert Query Pin
David Skelly9-Feb-10 5:27
David Skelly9-Feb-10 5:27 
GeneralRe: Reading variables in Insert Query Pin
gregarion9-Feb-10 5:29
gregarion9-Feb-10 5:29 
GeneralRe: Reading variables in Insert Query Pin
David Skelly10-Feb-10 6:04
David Skelly10-Feb-10 6:04 
GeneralRe: Reading variables in Insert Query Pin
Richard MacCutchan9-Feb-10 6:32
mveRichard MacCutchan9-Feb-10 6:32 
Questiondoubt in multiple criteria Pin
Mogamboo_Khush_Hua9-Feb-10 2:44
Mogamboo_Khush_Hua9-Feb-10 2:44 
AnswerRe: doubt in multiple criteria Pin
Mycroft Holmes9-Feb-10 13:21
professionalMycroft Holmes9-Feb-10 13:21 
AnswerRe: doubt in multiple criteria Pin
WoutL9-Feb-10 20:12
WoutL9-Feb-10 20:12 
GeneralRe: doubt in multiple criteria Pin
Hesham Amin9-Feb-10 20:34
Hesham Amin9-Feb-10 20:34 

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.