Forum Replies Created

Viewing 15 posts - 76 through 90 (of 443 total)

  • RE: sum() returns no record, and result is involved in summation

    CirquedeSQLeil (5/20/2010)


    Atif Sheikh (5/20/2010)


    Why dont you write the query as;

    Select Sum(CPC)

    from campaignclicks

    where campaignID = 8

    Throw in the isnull and it seems this would work as well.

    Very right. But I...

  • RE: Egg exists in the basket ???

    elutin (5/20/2010)


    I can suggest cursor-free and UDF-free string split functionality :

    declare @pInput varchar(max)

    set @pInput = 'A123,B123,C123,D123,E123,F123'

    ;with split

    as

    (

    select CASE WHEN LEN(@pInput)= 0 THEN ''

    ...

  • RE: Egg exists in the basket ???

    Not Returning all values...

  • RE: spliting nested string

    If you dont have fnSplit function, here is the code;

    SET ANSI_NULLS ON

    GO

    SET QUOTED_IDENTIFIER ON

    GO

    CREATE function [dbo].[fnSplit]

    (@pString nvarchar(max),@pSplitChar char(1))

    returns @tblTemp table (tid int,value varchar(1000))

    as

    begin

    declare @vStartPositionint

    declare @vSplitPositionint

    declare @vSplitValuevarchar(1000)

    declare @vCounterint

    set @vCounter=1

    select @vStartPosition =...

  • RE: spliting nested string

    I hope this will help;

    Declare @StringInput varchar(100)

    Declare @v-2 varchar(100)

    Declare @v1 varchar(100)

    Set @StringInput = '199:141,3,5,7,4:56,43,58,5:34,67r,234'

    Declare @OutputTable TABLE ( [String1] VARCHAR(10),[String2] VARCHAR(10))

    Declare C1 Cursor for Select [value] from dbo.fnSplit(@StringInput,',')

    Open C1

    Fetch...

  • RE: Egg exists in the basket ???

    Try fnSplit. Its a Table valued function. This function will return the character separated values in a table.

    By using this function, there will be no need of creating temporary table....

  • RE: how to do this => SET a row by default

    Is there any userID so that you can identify which user is adding/updating/Deleting a row from his/her own pool? I think it should be done on the basis of...

  • RE: Use Dynamic SQL to Improve Query Performance

    I have executed the queries posted in the article. The table product.tblProduct have an index on Name Column. This column is used with LIKE operator in the query. If the...

  • RE: Use Dynamic SQL to Improve Query Performance

    Dynamic SQL is the last thing to do. I use and prefer the following way;

    SELECT [Name],

    [Color],

    ...

  • RE: sum() returns no record, and result is involved in summation

    Why dont you write the query as;

    Select Sum(CPC)

    from campaignclicks

    where campaignID = 8

  • RE: Working with Temp Tables

    I dont think that the Logic of both results will be same. What I mean is that the logic for Condition 1=1 would be different from the logic of 1=0...

  • RE: Working with Temp Tables

    Another Option;

    Create Table #tempA

    (

    AID int,

    ACol1 varchar(100),

    ACol2 varchar(100)

    )

    Create Table #tempB

    (

    BID int,

    BCol1 varchar(100),

    BCol2 varchar(100),

    BCol3 varchar(100)

    )

    IF 1 <> 1

    BEGIN

    Insert into #tempA

    Select ID,Code,[Name] From dbo.countries

    Select * from #tempA

    --And Further Logic of on...

  • RE: List of Tables Used in an Query

    Are you looking for dependent Tables in SP / Function?

    if Yes,

    select distinct *

    from

    (

    SELECT sd.object_id object_id,

    OBJECT_NAME(sd.object_id) OBJECT_NAME,

    OBJECT_NAME(referenced_major_id) Ref_OBJECT_NAME, referenced_major_id Ref_OBJECT_Id

    FROM...

  • RE: Problem in query while executing through stored procedure

    Can you please post some test data?

  • RE: Backup\ Restore completion Status.

    confused...

Viewing 15 posts - 76 through 90 (of 443 total)