Forum Replies Created

Viewing 15 posts - 286 through 300 (of 337 total)

  • RE: Replacing only numeric value on a string

    declare @STR varchar(50)='my invoice number 3688992'

    declare @num varchar(max)=''

    declare @value varchar(50)='456'

    select @STR

    select @num=@num+''+n from

    (

    select SUBSTRING(@str,number,1)n from master..spt_values

    where number<LEN(@str)and type='P'

    )T where n between '0' and '9'

    select...

  • RE: Averaging data streaks

    keymoo (11/22/2010)


    Thanks it doesn't give me the correct results for dates that are the same. Is there a tweak needed to do that?

    Please post some sample data and expected result...

  • RE: deleting huge records From Table

    Jeff Moden (11/22/2010)


    I agree. Just to be clear for folks that may think of doing it, don't ever shift from FULL recovery to SIMPLE recovery for the sake of...

  • RE: Averaging data streaks

    ;with cte

    as

    (

    select *,ROW_NUMBER()over(order by (select 1))-row_number()over(partition by winloss order by winloss)rid from

    (

    select

    tradeDateTime,[tradeId]

    , case when [profit] >=0 then 'W' else 'L' end as WinLoss

    ...

  • RE: Getting Weekdays date between a specified date range

    OR something like this

    declare @StartDate datetime = '2010-11-22'

    declare @EndDate datetime = '2010-12-22'

    ;with DateSequence

    as

    (

    select @StartDate Date

    union all

    select Date+1 from DateSequence where Date<@EndDate...

  • RE: SQL Book

    jagirdba (11/20/2010)


    Hi Folks,

    I am currently preparing for SQL DBA job interview. Can somebody please suggest a good book to study.

    I would really appreciate it.

    Thank you

    I am appearing for an interview...

  • RE: Table Normalization

    parivedamohan (11/20/2010)


    Hi All,

    I am new to the Database world.

    I would be very happy if any body Normalize the below table, which is in First Normal Form (1NF).

    Table:

    CREATE...

  • RE: best course of action

    Does not make sense to me...

    Can't you just convert the data in uppercase in your application code or in reporting tool where you need to show it?

  • RE: How to repeat/or duplicate my results?

    Your Query

    GO 100 🙂

  • RE: sql server

    declare @val int

    declare @tblname1 as varchar(50)

    declare @tblname2 as varchar(50)

    set @tblname1='tbl_00001'

    set @tblname2='tblSt_00001'

    exec(';with cte1

    as

    (

    select line,Status_text,Zerox_ID from '+@tblname1+'

    except

    select line,Status_txt,Zerox_file_ID from '+@tblname2+'

    except

    select line,Status_txt,Zerox_file_ID from '+@tblname2+'

    except

    select line,Status_txt,Zerox_file_ID from '+@tblname2+'

    )

    select '...

  • RE: replace credit card numbers with *

    Something like this

    select stuff('5490 1234 5678 9128',1,12,'************')

  • RE: Date Time Convertion

    nageshp (11/17/2010)


    SELECT CONVERT(DATETIME,((SELECT CONVERT (VARCHAR,GETDATE(),101))+' ' +(SELECT SUBSTRING (CONVERT(VARCHAR,GETDATE(),109),14,27 ))))

    Output

    11/17/2010 2:01:51:833PM

    Still am not able to remove the milliseconds as it should be below.

    11/17/2010 2:01:51PM

    select CONVERT(varchar(20),GETDATE(),120)

  • RE: Need help in writing select query

    declare @Employeetable as table(ID int,Name varchar(20),

    Age int,Country varchar(20),

    Manager varchar(20),Status varchar(20));

    insert @Employeetable

    select 1,'Ravi',29,'IN','Anil','A'union

    select 2,'Balaji',30,'IN','Siju','A'union

    select 3,'Sanjeev',31,'IN','Venkat','A'

    select ID,Name,Age,Value from

    (

    select * from @Employeetable)u

    unpivot (Value for columns in (country,manager,status))v

  • RE: Question on Merging two cases

    So what should be the o/p when variable value is ALL?

Viewing 15 posts - 286 through 300 (of 337 total)