Forum Replies Created

Viewing 15 posts - 76 through 90 (of 4,080 total)

  • Reply To: need help on a request

    The query below will produce the combined results of your four queries.     However, I think it would be more meaningful if you also included the TYPE and the ORIGINE...

    __________________________________________________

    Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
    Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills

  • Reply To: Relational Table SQL Query Optimization/Performance Issue?

    Might be worthwhile to first query the commodities table and put the results into a #temp table indexed on commodityID, then join to the #temp table.   Depends on how many...

    __________________________________________________

    Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
    Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills

  • Reply To: STIntersect

    Sorry for being gone so long, regretfully I was in the hospital.   Apologies.    Sadly, I worked with all this years ago and have given away all my books.   ...

    __________________________________________________

    Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
    Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills

  • Reply To: Reading a variable from sqlcmd script back into a stored procedure

    Can you direct the output from the SQLCMD script to a text file, then open it using OpenRowset??

    __________________________________________________

    Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
    Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills

  • Reply To: Multi select parameter does not work in WHERE clause

    Are there no SYBASE forums?   😉

     

    __________________________________________________

    Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
    Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills

  • Reply To: repeating block of records

    You didn't specify a length of the strings you wanted.   This illustrates finding repeats from 1 to 4 strings long.    The LEAD() function allows the query to look 1...

    __________________________________________________

    Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
    Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills

  • Reply To: SQL Query Execution time

    Assuming you are talking about SELECT statements, it really depends on the amount of data being retrieved.    But usually anything running for three minutes is NOT running efficiently.   ...

    __________________________________________________

    Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
    Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills

  • Reply To: How to apply rank when fetching data from table using sql query?

    You're welcome.    And I admire Drew's solution.    Just couldn't dredge one as elegant up.

     

    __________________________________________________

    Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
    Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills

  • Reply To: Identity column as Primary Key - good or bad?

    bmg0002:

    Just to clarify, I am not advocating a unique int (or bigint) column simply as a row identifier.   It would become the primary key which all foreign keys would refer...

    __________________________________________________

    Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
    Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills

  • Reply To: How to apply rank when fetching data from table using sql query?

    What you are showing in your example isn't a true rank.   Essentially it is just grouping similar status codes,  incrementing an integer each time the status code changes.     You...

    __________________________________________________

    Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
    Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills

  • Reply To: One table or two?

    Even if an table is fairly wide, applications can always run against covering indexes and indexed views.    The key question is whether the data from the first file has to...

    __________________________________________________

    Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
    Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills

  • Reply To: I am looking to optimize this T-SQL Statement (it generates very High Reads..)

    An existence test and a TOP 1 both stop as soon as they find a row that satisfies the WHERE conditions.    Run the following code.    Although execution plans...

    __________________________________________________

    Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
    Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills

  • Reply To: Execute a procedure with parameter from table, one by one

    A function cannot do an UPDATE.    But for just retrieving data, I agree with the cross apply approach.

    What Jeff and others are trying to explain is that if your...

    __________________________________________________

    Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
    Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills

  • Reply To: Merge vs other options

    Row locks run  slower than page locks, which are the default locks used by SQL Server.     (https://littlekendra.com/2016/02/04/why-rowlock-hints-can-make-queries-slower-and-blocking-worse-in-sql-server/)   I'm not sure what you think Rowlock will buy you.

    Merges run best...

    __________________________________________________

    Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
    Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills

  • Reply To: Identity column as Primary Key - good or bad?

    I"m going to weigh in on the side of artificial keys.    I have wavered on this issue for a long time, but what ultimately convinced me was the annoying...

    __________________________________________________

    Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
    Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills

Viewing 15 posts - 76 through 90 (of 4,080 total)