Forum Replies Created

Viewing 15 posts - 8,521 through 8,535 (of 8,732 total)

  • RE: format for phone number

    It should be char or varchar.

    Ideally you should only store the digits and format the phone in the front end. However, you'll need an extra field for extension if needed.

  • RE: How to change datatype?

    To a column? or to a variable?

  • RE: RANK/TOP WITHOUT TIES

    You're right Sean, I missed something.

    EDIT: I need more coffee or to read more carefully.

  • RE: RANK/TOP WITHOUT TIES

    I had the idea that the group by would do the sort. However, it might not be the safest thing to do it.

    Your query gave me some incorrect results when...

  • RE: RANK/TOP WITHOUT TIES

    I tested my last solution and won't give the exact results.

    Try this instead:

    ;with MyRank (col1)

    as

    (

    select 6 union all

    select 5 union all

    select 4 union all

    select 3 union all

    select 2 union all

    select...

  • RE: RANK/TOP WITHOUT TIES

    Another option:

    ;with MyRank (col1)

    as

    (

    select 5 union all

    select 4 union all

    select 3 union all

    select 2 union all

    select 1 union all

    select 1 union all

    select 1

    )

    SELECT TOP 5 col1

    FROM MyRank

    GROUP BY...

  • RE: Given Letter, Get Next Letter in Alphabet

    You could return a 'Z' or a NULL

    SELECT NextLetter = CASE WHEN ascii(@Letter) IN (122,90)

    THEN NULL --What would you return here?

    ...

  • RE: Stored procedure in a function

    Please, don't go step by step.

    You have 3 posts very similar and it seems to me that you're not giving us the entire problem.

    If we're aware of the whole context,...

  • RE: How to diagnose a query with a sub-query against another server.

    Have you tried a JOIN instead of the IN?

    I've read there can be unexpected problems with cross-server queries.

    SELECT --USE DISTINCT if there are multiple rows in vwCRMServiceProviderAccess

    SP.[ServiceProviderGuid],

    SP.[ServiceProviderTypeGuid],

    SP.[ServiceProviderName],...

  • RE: find a grouping with at least one row within the group containing a certain value

    Indeed, the query is wrong and it won't take you near to the solution.

    I suggest you to avoid that opinion and stay with Dwain's solution.

  • RE: Make Sequential numbers into ranges

    Next time you should post on the correct forum. 😉

    You could have avoided that Lynn hits his head with the desk.

    Seriously, you can get better answers if you do so.

  • RE: Make Sequential numbers into ranges

    Lynn, your solutions are great :-D. But this is the 7,2000 forum 🙁

    I wonder if that helps the OP.

  • RE: Query Result in HTML format

    Divide and Conquer.

    Divide your html into 3 parts: headers, rows and closure.

    OK, I misread. All you have to do is add an ISNULL outside the CAST.

    However, the original suggestion is...

  • RE: increment values on day basis on column

    Eugene Elutin (8/28/2012)


    anuj12paritosh (8/28/2012)


    HI ALL

    PLEASE PROVIDE SOME EASY WAY IF YOU KNOW

    THANKS

    The easiest way to achieve that will be switching to SQL2012 and using sequences.

    All others ways will not...

  • RE: Selecting records based on string search

    Too complicated. Keep it simple.

    create procedure dbo.STORED_PROC_NAME

    (

    @sstrg varchar(100)

    )

    as

    begin

    set nocount on;

    --declare @strg varchar(100) = 'Catalog',

    set @sstrg = '%' + REPLACE( @sstrg, '*', '%') + '%'

    SELECT project_name

    FROM groups

    WHERE...

Viewing 15 posts - 8,521 through 8,535 (of 8,732 total)