Forum Replies Created

Viewing 15 posts - 196 through 210 (of 428 total)

  • RE: Trigger to insert records on a linked server else in a local server

    kbsk333000 (6/23/2011)

    Is there any alternate way in trigger?

    Yes there is, it is called SQL Server Service Broker. SSB is SQL server's service/queue mechanisme. It will let you, from the trigger...

  • RE: Convert Time Stamp in Query

    Please provide the DDL for your table so we can give you proper advise. Follow the link to Jeff Moden's article on posting etiquette in my footer text if you...

  • RE: Convert rows to columns

    Have a look a Jeff Moden's article about crosstab's, the link is in my footer text.

    with cteClaims as (

    select row_number() over (partition by c.[Claimant Number] order by...

  • RE: select for date field

    Formatting the date should not be done in T-SQL. Formatting (read: "creating an end-user representation of the date value") is the responsibility of the front-end. How would you implement showing...

  • RE: Remove Some Duplicate Rows with the Oldest InsertDate

    You can very easily use the row_number() function to do this.

    with cte as (

    select row_number() over (partition by MemberFullName order by DateEntered) as nr,

    ...

  • RE: index column order for a clustered primary key

    So I was wrong indeed (and I will quickly revoke the QoD based on this :Whistling:)

    I do think I'll put up a new one, just to illustrate how easily one...

  • RE: filter two table by date arrange

    No DDL in your question ,so untested code:

    declare @dateFrom datetime;

    declare @dateTo datetime;

    select @dateTo = getdate(),

    @dateFrom = dateadd(day, -14, @dateTo);

    select top 10 p.*, c.cnt

    from ProductDetails p

    ...

  • RE: Pivot

    bteraberry (10/31/2011)


    This is a good little trick if you want all values concatenated for a related ID:

    selecttd.irecordid

    ,td.recording_suffix

    ,grantors =

    ...

  • RE: Help Appreciated

    I'm sorry but there is too much wrong in your query to make anything out of it. You'll have to describe what you intended to do, because this does not...

  • RE: Help Appreciated

    For me it results in a totally different set of errors:

    Msg 156, Level 15, State 1, Line 2

    Incorrect syntax near the keyword 'case'.

    Msg 156, Level 15, State 1, Line 26

    Incorrect...

  • RE: Select top five rows for each key value

    The request was to produce 5 rows, not the top 5 values. row_number() is the way to produce at most 5 rows. rank() can be used to produce any number...

  • RE: Select top five rows for each key value

    You should use row_number() instead of rank() if you intend to get the top most 5 entries. rank() will return the same number for rows with duplicate date values, i.e....

  • RE: question about SQL

    Apart from the technical reasons not to use coalesce (or isnull, which does the same thing) in join or where clauses, this problem is better addressed by a little remodeling...

  • RE: Enriching duplicate records (not deleting)

    Did you think of a way to "clean" those phone numbers yet? i.e. '123-4567890' won't be the same number as '1234567890' or '123 - 4567890' if you don't clean them...

  • RE: Enriching duplicate records (not deleting)

    Here's an example:

    ID, phone name email

    1, null, 'companyA', 'companya@hotmail.com'

    2, null, 'companyA', 'x@companya.com'

    3, null, 'companyB', 'companya@hotmail.com'

    See how the row with ID = 1 fits both your rules 2 and 3 at...

Viewing 15 posts - 196 through 210 (of 428 total)