Forum Replies Created

Viewing 15 posts - 841 through 855 (of 1,229 total)

  • RE: Loading dummy data

    BinaryDigit (5/13/2011)


    thank you, so it doesn't have to be completely different values just that they are unique?

    One or the other will do just fine 😉

    Jeff Moden has a sample data...

  • RE: Applying distinct on more than one field?

    info-849042 (5/13/2011)


    Hi,

    I have a SQL query, like so:

    SELECT DISTINCT ID, Name FROM Table

    This brings up all the distinct IDs (1...13), but in the 13 IDs, it repeats the name (as...

  • RE: Updating tables with Primary and Foreign Keys

    Stringzz (5/12/2011)


    I need to update employee id's in our HR database. The problem is there are a lot of primary and foreign keys in the tables in the database. I...

  • RE: Multiple OR's and a single AND

    Duncan Pryde (5/10/2011)


    terrykzncs (5/10/2011)


    Unfortunately it is a big table. If I use = and put the exact wording will that be faster? I will have to...

  • RE: Help With Query

    SELECT

    TEN.[tncy-sys-ref] + CASE

    WHEN PER.[GENDER] = 'M' THEN '1' ...

  • RE: Help With Query

    Ryan, can you confirm which version of SQL Server you've been working on please?

    Cheers

    ChrisM

  • RE: Need a SQL query to calculate the average datetime column

    Dhruva25 (5/6/2011)


    Thanks for response.....i am getting negative values for some and pretty huge year values for some..my query below :

    select AVG(DATEDIFF(D,DINVPDOF, DOCDATE)), CUSTNMBR from

    (select docnumbr,custnmbr,dinvpdof,curtrxam,

    ( RANK() over (partition by...

  • RE: Can't create a view inside and IF block?

    buddy__a (5/5/2011)


    My script s designed to update an existing database so I need to check for existence first. It's an indexed view so I don't really want to drop...

  • RE: Can't create a view inside and IF block?

    From Books Online: "CREATE VIEW must be the first statement in a query batch. "

    What are you really trying to do by conditionally creating a view?

  • RE: how to write this query

    Mad-Dog (5/5/2011)


    here is the table

    CREATE TABLE [dbo].[TBL_REPORT_COLLECT_USERS_CONNECTION](

    [RUN_TIME] [datetime] NOT NULL,

    [USERS_COUNT] [int] NOT NULL,

    [CONNECTION_COUNT] [int] NOT NULL

    here is the insert every hour

    INSERT INTO TBL_REPORT_COLLECT_USERS_CONNECTION(RUN_TIME,USERS_COUNT,CONNECTION_COUNT)

    SELECT GETDATE()AS 'RUN_TIME',COUNT(DISTINCT loginame) AS 'USERS_COUNT',count(spid)AS 'CONNECTIONS_COUNT'

    FROM master.sys.sysprocesses...

  • RE: UPDATE query question

    Did your select look like this:

    SELECT field1 = (RIGHT(('00000000' + convert(nvarchar(8), ((SELECT count(*) + 1 FROM table1 o WHERE t.field2 > o. field2 and t.field3 = 'xxx')))),8))

    FROM table1 t

    WHERE t.field1...

  • RE: Assistance with SQL

    Gathering information - is it sales for today and the same day last year? If not, please explain in detail.

    Do you want sales for this year / last year on...

  • RE: Are the posted questions getting worse?

    Tom.Thomson (5/2/2011)


    ChrisM@home (5/2/2011)


    Koen Verbeeck (5/1/2011)


    ChrisM@home (4/30/2011)


    LutzM (4/30/2011)


    Slightly different over here in Germany: if a holiday falls on a Sunday (as it happens with May 1st this year), we won't get...

  • RE: Find all orders that have EXACTLY the same items

    Jeff Moden (5/3/2011)


    ChrisM@home (5/3/2011)


    Here's another version using APPLY without any sneaky tricks.

    Chris, run an estimated execution plan of your code against the following 10,000 rows of data and look at...

  • RE: Tally OH! An Improved SQL 8K “CSV Splitter” Function

    Ninja's_RGR'us (5/3/2011)


    SQLRNNR (5/3/2011)


    WayneS (5/3/2011)


    ChrisM@home (5/3/2011)


    Jeff, please please please write a book, without changing your style. Give us all an opportunity to repay you for what you've done for us.

    +10!

    Yes, please...

Viewing 15 posts - 841 through 855 (of 1,229 total)