Forum Replies Created

Viewing 11 posts - 31 through 41 (of 41 total)

  • RE: Use of Mapping Tables

    See this

    Normalisation

  • RE: Split string field based on character position

    You just have to be little careful while using any Split function as you are dealing with 2 delimiters here - comma and space

    See this example

    EDIT NOTE : My XML...

  • RE: How to remove duplicate rows

    Try this

    --select

    ;WITH CTE AS

    (

    SELECT *,ROW_NUMBER()OVER(PARTITION BY Ltel ORDER BY lstatus desc) AS SEQ FROM @list

    )

    SELECT *

    FROM cte

    WHERE LSTATUS =0

    and seq>1

    --delete

    ;WITH CTE AS

    (

    SELECT *,ROW_NUMBER()OVER(PARTITION BY Ltel ORDER BY lstatus desc) AS...

  • RE: Query Help

    I guess it should be

    (partition by projid order by commentdt DESC)

    Lowell (2/25/2009)


    select * from

    (

    select P.ProjId, X.Comment, X.CommentDt,row_number() over (PARTITION BY X.Comment ORDER BY P.ProjId) AS RW

    FROM Proj P

    INNER JOIN...

  • RE: Dynamic value as an alias name

    DECLARE @a varchar(10) -- declaration of variable

    SET @a = DATEPART(YEAR,DATEADD(YEAR,0,'01/01/2009'))

    DECLARE @SQL NVARCHAR(200)

    SELECT @SQL = 'SELECT CASE WHEN 2009 = 2009 THEN 1

    ...

  • RE: converting milliseconds

    Going back to school

    declare @MILI bigint

    set @mili= 1*60*60*1000+2010

    select @mili

    ,@Mili/(1000*60*60) as Hour

    ,(@Mili%(1000*60*60))/(1000*60)as Minutes

    ,((@Mili%(1000*60*60))%(1000*60))/1000 as Seconds

    ,((@Mili%(1000*60*60))%(1000*60))%1000 as MiliSecs

  • RE: Complex mathematical calculation using TSQL

    select 175*(power((95*0.011312),-1.154))*power(CONVERT(FLOAT,65),(-0.203)) as cal

  • RE: Using a wildcard with IN

    I guess that won't work, instead use OR operator

    SELECT *

    FROM person

    WHERE personname LIKE '%mar%'

    OR personname LIKE '%jo%'

  • RE: Migrate from MYSQL to MSSQL Server 2005

    Using Sql Server Import/Export wizard you can easily import the data into sql server. You can also try Linked Server with MySQL - Linked server with MySQL

    Or you can...

  • RE: update statement for each row

    See this example on adventureworks database

    USE AdventureWorks

    GO

    SELECTfirstname

    ,LEFT (Firstname,1)AS First

    ,row_number()over(PARTITION BY LEFT (Firstname,1) ORDER BY Firstname) as Seq

    ,LEFT (Firstname,1)+RIGHT('00000'+CONVERT(VARCHAR(10),row_number()over(PARTITION BY LEFT (Firstname,1) ORDER BY Firstname)),5) newseq

    FROM Person.Contact

    order by Firstname

    On similar...

  • RE: Question on pivot tables

    Construct your pivot query as following

    select *

    from

    ( select *

    from dbo.getresults

    ) Main

    PIVOT

    (AVG([AVG]) for in

    ([Buffer Manager\Buffer cache hit ratio] ,[PhysicalDisk(_Total)\% Disk Time] ,[PhysicalDisk(_Total)\Current Disk Queue Length] ,[Processor(_Total)\% Processor...

Viewing 11 posts - 31 through 41 (of 41 total)