Forum Replies Created

Viewing 15 posts - 601 through 615 (of 1,923 total)

  • RE: Help needed getting summary by weeks of current month

    Totally possible if you have a calendar table designed for your needs. Else we need to play with SET DATEFIRST statments and then can achieve the result.

    it would immensely help...

  • RE: Tricky Query

    Performace Guard (Shehap) (10/9/2011)


    You are right Jeif, i have missed one business case, therefore to match up perfectly with the output results , we could go with the udpate statements...

  • RE: Tricky Query

    Like this..

    SELECT A.* , CrsAppOutput.Percentage , CrsAppOutput.EffectiveDate

    FROM tblA A

    CROSS APPLY

    (

    SELECT TOP 1 B.Percentage , B.EffectiveDate

    FROM tblB...

  • RE: Tricky Query

    How about this?

    SELECT A.* , CrsAppOutput.Percentage

    FROM tblA A

    CROSS APPLY

    (

    SELECT TOP 1 B.Percentage

    FROM tblB B

    ...

  • RE: Adding either a "1" or "2" in a column (using Select, Union All, and three tables)

    Not information to check what wrong and what you require. You may want to read Jeff Moden's article on how to post your problems to get fast and accurate answers...

  • RE: Data Grouping

    How about this Jeff ???

    ; WITH cte AS

    (

    SELECT *

    ,RowNum = ROW_NUMBER() OVER( PARTITION BY eid ORDER BY eno )

    ,GrpCnt = COUNT(*) OVER(...

  • RE: how to display single column in result

    May be this?

    declare @Tab Table

    ( id int,

    professionalism int,

    communication ...

  • RE: I need help with this SQL script

    Try this:

    SELECT

    [IdPartition],

    LEFT([SavesetID],8)AS Date,

    SUBSTRING([SavesetID],38,4)AS DVSFilePath,

    SUBSTRING([SavesetID],38,99)AS DVSFileName,

    FolderStructure =

    ((CASE [IdPartition]

    WHEN 0 THEN 'mailstore1 ptn1\'

    WHEN 1 THEN 'mailstore1 ptn2\'

    WHEN 2 THEN 'mailstore1 ptn3\'

    END

    )

    +LEFT([SavesetID],4) + '\'

    +SUBSTRING([SavesetID],5,2) +'-'

    +RIGHT([SavesetID],2) +'\'

    +SUBSTRING([SavesetID],38,1) +'\'

    +SUBSTRING([SavesetID],39,3)...

  • RE: I need help with this SQL script

    You cant use IF statement in a SELECT clause.. You can use CASE expression though.

  • RE: Trying to avoid RBAR

    Try this:

    1. This will be fruitful and can see the results in TEXT mode.

    SELECT p1.Field,

    STUFF ( ( SELECT ','+ Contents+ CHAR(13)

    ...

  • RE: how to mask the values

    Mr.Rams, you are not kidding us right ? 😛

    To be honest, I understood really nothing from your question.. Can you be more clear, more visualizing on asking ur question ??...

  • RE: Table update problem

    This may be?

    ; with cte as

    (

    select *

    , rn = ROW_NUMBER() over( partition by account order...

  • RE: Need a Query

    shatrughna (9/29/2011)


    Hi,

    You can try this one.

    DECLARE @test-2 TABLE

    (A INT,B INT,C INT)

    INSERT INTO @test-2

    SELECT 10,1,1

    UNION ALL

    SELECT 10,1,2

    UNION ALL

    SELECT 10,2,1

    UNION ALL

    SELECT 10,2,2

    UNION ALL

    SELECT 10,3,1

    UNION ALL

    SELECT 10,3,2

    UNION ALL

    SELECT 11,1,1

    UNION ALL

    SELECT 11,1,2

    UNION ALL

    SELECT...

  • RE: Splitting XML

    There is a function called STUFF which will do exactly what you asked for.

  • RE: SQL Insert Data from one table to other table

    maruthipuligandla (9/28/2011)


    WHERE Serial not in (select Serial from ReDB.dbo.Countries)

    The problem might be due to improper aliases.

    Try this:

    INSERT INTO ReDB.dbo.Countries (CountryID, Serial, CountryDesc, DateAdded)

    SELECT NEWID(), Serial, CountryName, GETDATE()

    FROM v8.dbo.Country v8_contry

    WHERE...

Viewing 15 posts - 601 through 615 (of 1,923 total)