Forum Replies Created

Viewing 15 posts - 31 through 45 (of 1,082 total)

  • RE: Slow SQL Query

    You have two problems with the query.

    1 you covering index only covers the columns in the where clause and not the columns in your output clause so you will get...

    ----------------------------------------------
    Try to learn something about everything and everything about something. - Thomas Henry Huxley

    :w00t:
    Posting Best Practices[/url]
    Numbers / Tally Tables[/url]

    SQL-4-Life
  • RE: can we do looping in select query.

    try this:

    CREATE TABLE purchase --table:

    (Date DATETIME,

    Location VARCHAR(100),

    Purchase_id INT)

    INSERT INTO purchase

    SELECT '2009-12-24', 'Dadar', 123

    CREATE TABLE Item --table:

    (Item_name VARCHAR(100),

    Item_id INT)

    INSERT INTO Item

    SELECT 'Laptop', 21 UNION ALL

    SELECT 'Mouse', 22 UNION ALL

    SELECT 'Speaker', 23

    CREATE...

    ----------------------------------------------
    Try to learn something about everything and everything about something. - Thomas Henry Huxley

    :w00t:
    Posting Best Practices[/url]
    Numbers / Tally Tables[/url]

    SQL-4-Life
  • RE: SQL brian teaser...

    WOW.

    Lynn that is some awesome code. Very clever and very fast 🙂

    ----------------------------------------------
    Try to learn something about everything and everything about something. - Thomas Henry Huxley

    :w00t:
    Posting Best Practices[/url]
    Numbers / Tally Tables[/url]

    SQL-4-Life
  • RE: Crosstab query

    Depending on how you system works you might need to make this dynamic as you may get more years creeping in for example 2009/2010/2011 ect.

    if you need more help just...

    ----------------------------------------------
    Try to learn something about everything and everything about something. - Thomas Henry Huxley

    :w00t:
    Posting Best Practices[/url]
    Numbers / Tally Tables[/url]

    SQL-4-Life
  • RE: islowercase

    Because you using a case sensitive coalation so the query checks for case sensitivity

    ----------------------------------------------
    Try to learn something about everything and everything about something. - Thomas Henry Huxley

    :w00t:
    Posting Best Practices[/url]
    Numbers / Tally Tables[/url]

    SQL-4-Life
  • RE: islowercase

    try this:

    select *

    from customer

    where surname = LOWER(surname) COLLATE SQL_Latin1_General_CP1_CS_AS

    ----------------------------------------------
    Try to learn something about everything and everything about something. - Thomas Henry Huxley

    :w00t:
    Posting Best Practices[/url]
    Numbers / Tally Tables[/url]

    SQL-4-Life
  • RE: Slow performances

    Could you provide us with the actual queries please.

    ----------------------------------------------
    Try to learn something about everything and everything about something. - Thomas Henry Huxley

    :w00t:
    Posting Best Practices[/url]
    Numbers / Tally Tables[/url]

    SQL-4-Life
  • RE: CHARINDEX in reverse

    you could also use this for the surname:

    SUBSTRING(@nam,LEN(@nam) - charindex(' ',@nam),LEN(@nam))

    ----------------------------------------------
    Try to learn something about everything and everything about something. - Thomas Henry Huxley

    :w00t:
    Posting Best Practices[/url]
    Numbers / Tally Tables[/url]

    SQL-4-Life
  • RE: CHARINDEX in reverse

    Have you tried this.

    taking the above post as base code.

    REVERSE(left(REVERSE(@nam), charindex(' ',REVERSE(@nam))-1))

    ----------------------------------------------
    Try to learn something about everything and everything about something. - Thomas Henry Huxley

    :w00t:
    Posting Best Practices[/url]
    Numbers / Tally Tables[/url]

    SQL-4-Life
  • RE: Create a nested query and optimize for low cpu and mem load

    Ok I'm gonna guess and say that some of those nested correlated queries are going to kill you.

    However please could you attach the Actual Graphical Execution plan (*.sqlplan) as a...

    ----------------------------------------------
    Try to learn something about everything and everything about something. - Thomas Henry Huxley

    :w00t:
    Posting Best Practices[/url]
    Numbers / Tally Tables[/url]

    SQL-4-Life
  • RE: Week of Month given week of year

    Ok here is an example of some code, it doesn't look up from a table but I think the formula is what you will be interested in.

    DECLARE @Year INT

    DECLARE @Month...

    ----------------------------------------------
    Try to learn something about everything and everything about something. - Thomas Henry Huxley

    :w00t:
    Posting Best Practices[/url]
    Numbers / Tally Tables[/url]

    SQL-4-Life
  • RE: Error while creating covering-index (Msg: 170)

    If you using 2000 you can't use include...

    ----------------------------------------------
    Try to learn something about everything and everything about something. - Thomas Henry Huxley

    :w00t:
    Posting Best Practices[/url]
    Numbers / Tally Tables[/url]

    SQL-4-Life
  • RE: Error while creating covering-index (Msg: 170)

    As far as know you can't use the INCLUDE in SQL 2000

    ----------------------------------------------
    Try to learn something about everything and everything about something. - Thomas Henry Huxley

    :w00t:
    Posting Best Practices[/url]
    Numbers / Tally Tables[/url]

    SQL-4-Life
  • RE: Brain lock on determine if char or not

    I must have missed something but I didn't see the op defining the input. The output rule is all that was defined.

    If you now the values are going to be...

    ----------------------------------------------
    Try to learn something about everything and everything about something. - Thomas Henry Huxley

    :w00t:
    Posting Best Practices[/url]
    Numbers / Tally Tables[/url]

    SQL-4-Life
  • RE: Brain lock on determine if char or not

    timscronin (6/26/2009)


    THanks, interesting now I am being told they can trap and to use a rule. Since the rule should allow for the first 2 char of being either...

    ----------------------------------------------
    Try to learn something about everything and everything about something. - Thomas Henry Huxley

    :w00t:
    Posting Best Practices[/url]
    Numbers / Tally Tables[/url]

    SQL-4-Life

Viewing 15 posts - 31 through 45 (of 1,082 total)