Forum Replies Created

Viewing 15 posts - 946 through 960 (of 1,082 total)

  • RE: SELECT WHERE IN

    Hi Peter,

    I suggest making sure you are connected to the correct DB before going through with your format!

    Thanks

    Chris

  • RE: Substring

    HI,

    Try this:

    SELECT RIGHT([MyVarchar],CHARINDEX('_',REVERSE([MyVarchar]))-1)

    Thanks

    Chris

  • RE: Case statement

    Hi Adam,

    Out of interest, would a computed col be a bad implimentation for this problem?

    Thanks

    Chris

  • RE: Case statement

    HI ,

    Not sure that this falls into best practise maybe someone can help.

    But you could also create BillingMonthas a computed column

    e.g

    CREATE TABLE dbo.Mytable

    (

    Col1 INT

    ,Col2 VARCHAR(100)

    ,etc....

    ,Leadtime INT

    ,OITDate INT

    ,BillingMonth as [Leadtime] +...

  • RE: Case statement

    Hi,

    Ok in this line

    (OITDate+Leadtime) as BillingMonth

    replace Leadtime

    With the record the case statement that you used to determine Leadtime.

    I'll look into another method as this may not be the best...

  • RE: Case statement

    HI again 🙂

    Sorry I didn't read through you code properly.

    From my knowledge you can not reference an ALIAS from a select in the same select.

    Hope this helps?

    you may need to...

  • RE: Case statement

    HI ,

    The convert should work!

    your syntax is wrong though. should be: CONVERT(VARCHAR(10), [DATEVALUE],103) as [VARNAME]

    ARe you sure that :Leadtime is a valid col in your ReportingData table?

    Thanks

    Chris

  • RE: Case statement

    HI There,

    Please could you provide the full update statement?

    Thanks

    Chris

  • RE: query to fetch n'th row of a table

    Hi,

    The above solution is missing the order by in the over clause:

    select * from

    (select *, row_number() over(ORDER BY ID) AS RowNo FROM Employee) Emp

    where RowNo = @Num

    I also did...

  • RE: query to fetch n'th row of a table

    HI There,

    Haev you tried running that code?

    I ran it on a table of 428577 rows for the N = 5 and it ran for 5minutes and then I cancelled...

  • RE: Table design for Country look-ups

    Thanks for the reply 🙂

    The one thing that concerns me is that for our 3 country tables at the moment they all have the same number of rows referencing the...

  • RE: Table design for Country look-ups

    Hi All,

    Does anyone have any feedback on this for me?

    Thanks

    Chris

  • RE: Error when Split function is executed..?

    Hi ,

    Just in case you are interested.

    If you have a numbers/tally table in your database which is always good to have.

    Here is an alternate to your split function that does...

  • RE: Error when Split function is executed..?

    Hi,

    The reason for this is that you have created a tabular function (meaning it returns a table).

    To get data from this type of function you need to treat it as...

  • RE: Look-up Table (24ms vs 5ms)

    HI Grant,

    Thanks for your reply, and that is pretty much what I was expecting someone to come back and say.

    I also believe that you shouldn't put bad practise in place...

Viewing 15 posts - 946 through 960 (of 1,082 total)