Forum Replies Created

Viewing 15 posts - 451 through 465 (of 617 total)

  • RE: Compare max values from two tables in where clause

    They shouldn't. The query optimizer is pretty good. But you could try running it on a subset of your data and see how it does. In fact...

    Kenneth FisherI was once offered a wizards hat but it got in the way of my dunce cap.--------------------------------------------------------------------------------For better, quicker answers on T-SQL questions, click on the following... http://www.sqlservercentral.com/articles/Best+Practices/61537/[/url]For better answers on performance questions, click on the following... http://www.sqlservercentral.com/articles/SQLServerCentral/66909/[/url]Link to my Blog Post --> www.SQLStudies.com[/url]

  • RE: Need help with a join statement

    That is because you are using OUTER JOINS.

    FROM [HOSTSQL].[dbo].[IN_RES] sm2

    left outer join IN_GUEST sm1 on sm1.GUESTNUM = sm2.GUESTNUM

    left join IN_PLAYR sm3 on sm3.PIMGPATH = sm2.GUESTNUM

    where sm2.MEMTYPE !=''

    When you use an...

    Kenneth FisherI was once offered a wizards hat but it got in the way of my dunce cap.--------------------------------------------------------------------------------For better, quicker answers on T-SQL questions, click on the following... http://www.sqlservercentral.com/articles/Best+Practices/61537/[/url]For better answers on performance questions, click on the following... http://www.sqlservercentral.com/articles/SQLServerCentral/66909/[/url]Link to my Blog Post --> www.SQLStudies.com[/url]

  • RE: Compare max values from two tables in where clause

    I see 2 options for you.

    1) Use inline views

    SELECT DISTINCT l.omunique_id INTO #id

    FROM oms_log_attribute l

    JOIN oms_status_attribute u ON l.omunique_id = u.omunique_id

    JOIN

    ( SELECT omunique_id, MAX(seqnumber) Max_SeqNumber

    FROM oms_log_attribute

    WHERE attr_key =...

    Kenneth FisherI was once offered a wizards hat but it got in the way of my dunce cap.--------------------------------------------------------------------------------For better, quicker answers on T-SQL questions, click on the following... http://www.sqlservercentral.com/articles/Best+Practices/61537/[/url]For better answers on performance questions, click on the following... http://www.sqlservercentral.com/articles/SQLServerCentral/66909/[/url]Link to my Blog Post --> www.SQLStudies.com[/url]

  • RE: How to expand this variable for the query to work

    antonio.collins (1/8/2008)


    GSquared: With my biggest complaint nullified, I'm all for the numbers approach.

    And it's just that for my usage (big decision support queries) a 50ms improvement isn't...

    Kenneth FisherI was once offered a wizards hat but it got in the way of my dunce cap.--------------------------------------------------------------------------------For better, quicker answers on T-SQL questions, click on the following... http://www.sqlservercentral.com/articles/Best+Practices/61537/[/url]For better answers on performance questions, click on the following... http://www.sqlservercentral.com/articles/SQLServerCentral/66909/[/url]Link to my Blog Post --> www.SQLStudies.com[/url]

  • RE: How to expand this variable for the query to work

    I have to admit it took me a few read throughs to understand how you were using the numbers table. Its basically used as a list of positions in...

    Kenneth FisherI was once offered a wizards hat but it got in the way of my dunce cap.--------------------------------------------------------------------------------For better, quicker answers on T-SQL questions, click on the following... http://www.sqlservercentral.com/articles/Best+Practices/61537/[/url]For better answers on performance questions, click on the following... http://www.sqlservercentral.com/articles/SQLServerCentral/66909/[/url]Link to my Blog Post --> www.SQLStudies.com[/url]

  • RE: How to expand this variable for the query to work

    I'm certainly willing to accept that the number table and stringparser function work better than the LIKE code. Generally the tests I have done have been against fairly simple...

    Kenneth FisherI was once offered a wizards hat but it got in the way of my dunce cap.--------------------------------------------------------------------------------For better, quicker answers on T-SQL questions, click on the following... http://www.sqlservercentral.com/articles/Best+Practices/61537/[/url]For better answers on performance questions, click on the following... http://www.sqlservercentral.com/articles/SQLServerCentral/66909/[/url]Link to my Blog Post --> www.SQLStudies.com[/url]

  • RE: How to expand this variable for the query to work

    Actually there is a flaw in your logic. I agree if I am compairing '1' to '2,3,12' I'm going to get a false hit. However I'm compairing ',1,'...

    Kenneth FisherI was once offered a wizards hat but it got in the way of my dunce cap.--------------------------------------------------------------------------------For better, quicker answers on T-SQL questions, click on the following... http://www.sqlservercentral.com/articles/Best+Practices/61537/[/url]For better answers on performance questions, click on the following... http://www.sqlservercentral.com/articles/SQLServerCentral/66909/[/url]Link to my Blog Post --> www.SQLStudies.com[/url]

  • RE: How to expand this variable for the query to work

    Ok this is just an educated guess and I have absolutly no proof for it but maybe the DB engine will use the index on a field that not substantialy...

    Kenneth FisherI was once offered a wizards hat but it got in the way of my dunce cap.--------------------------------------------------------------------------------For better, quicker answers on T-SQL questions, click on the following... http://www.sqlservercentral.com/articles/Best+Practices/61537/[/url]For better answers on performance questions, click on the following... http://www.sqlservercentral.com/articles/SQLServerCentral/66909/[/url]Link to my Blog Post --> www.SQLStudies.com[/url]

  • RE: How to expand this variable for the query to work

    Antonio,

    I don't know what to tell you. I've seen and done tests on this a couple of dozen times and the LIKE version has ALWAYS been faster.

    Kenneth

    Kenneth FisherI was once offered a wizards hat but it got in the way of my dunce cap.--------------------------------------------------------------------------------For better, quicker answers on T-SQL questions, click on the following... http://www.sqlservercentral.com/articles/Best+Practices/61537/[/url]For better answers on performance questions, click on the following... http://www.sqlservercentral.com/articles/SQLServerCentral/66909/[/url]Link to my Blog Post --> www.SQLStudies.com[/url]

  • RE: How to expand this variable for the query to work

    Actually Antonio's first solution is going to be the better/faster one. Unless your list is enormous .. say 150+ items or more you are probably going to be better...

    Kenneth FisherI was once offered a wizards hat but it got in the way of my dunce cap.--------------------------------------------------------------------------------For better, quicker answers on T-SQL questions, click on the following... http://www.sqlservercentral.com/articles/Best+Practices/61537/[/url]For better answers on performance questions, click on the following... http://www.sqlservercentral.com/articles/SQLServerCentral/66909/[/url]Link to my Blog Post --> www.SQLStudies.com[/url]

  • RE: help insert employee to #temp table all month

    Ok I'm going to make a wild guess and say they are looking for a CASE statement to determine the weekday.

    empid date val day name

    -----------------------------------

    1111 1/2/2008 1 Tuesday

    1111 2/2/2008 1...

    Kenneth FisherI was once offered a wizards hat but it got in the way of my dunce cap.--------------------------------------------------------------------------------For better, quicker answers on T-SQL questions, click on the following... http://www.sqlservercentral.com/articles/Best+Practices/61537/[/url]For better answers on performance questions, click on the following... http://www.sqlservercentral.com/articles/SQLServerCentral/66909/[/url]Link to my Blog Post --> www.SQLStudies.com[/url]

  • RE: Large Table with Historical Data

    Jeff Moden (1/3/2008)


    Ravi Patel (1/3/2008)


    This feed is coming from one of our vendors, and they send the FULL data load on each run.

    If by FULL data load you mean they...

    Kenneth FisherI was once offered a wizards hat but it got in the way of my dunce cap.--------------------------------------------------------------------------------For better, quicker answers on T-SQL questions, click on the following... http://www.sqlservercentral.com/articles/Best+Practices/61537/[/url]For better answers on performance questions, click on the following... http://www.sqlservercentral.com/articles/SQLServerCentral/66909/[/url]Link to my Blog Post --> www.SQLStudies.com[/url]

  • RE: condition check

    create table emp (

    empsal int null constraint emptest check (case when datepart(dd,getdate()) >= 10 THEN (CASE WHEN empsal IS NULL THEN 0 ELSE 1 END) ELSE 1 END = 1)

    )

    Basically...

    Kenneth FisherI was once offered a wizards hat but it got in the way of my dunce cap.--------------------------------------------------------------------------------For better, quicker answers on T-SQL questions, click on the following... http://www.sqlservercentral.com/articles/Best+Practices/61537/[/url]For better answers on performance questions, click on the following... http://www.sqlservercentral.com/articles/SQLServerCentral/66909/[/url]Link to my Blog Post --> www.SQLStudies.com[/url]

  • RE: Large Table with Historical Data

    Another option (assuming you have unlimited space) is to create a set of working tables .. or a working database. Load the entire data set and then run compairs....

    Kenneth FisherI was once offered a wizards hat but it got in the way of my dunce cap.--------------------------------------------------------------------------------For better, quicker answers on T-SQL questions, click on the following... http://www.sqlservercentral.com/articles/Best+Practices/61537/[/url]For better answers on performance questions, click on the following... http://www.sqlservercentral.com/articles/SQLServerCentral/66909/[/url]Link to my Blog Post --> www.SQLStudies.com[/url]

  • RE: Passing in multiple Int values into store procedure

    Ok IMHO the easiest and in my experience fastest way to handle this particular exercise.

    DECLARE @CommaList varchar(8000)

    SET @CommaList '1,2,3,4,5,6'

    SELECT *

    FROM YourTable

    WHERE ','+@CommaList+',' LIKE '%,'+TableColumn+',%'

    NOTE: Ok there is the limit of...

    Kenneth FisherI was once offered a wizards hat but it got in the way of my dunce cap.--------------------------------------------------------------------------------For better, quicker answers on T-SQL questions, click on the following... http://www.sqlservercentral.com/articles/Best+Practices/61537/[/url]For better answers on performance questions, click on the following... http://www.sqlservercentral.com/articles/SQLServerCentral/66909/[/url]Link to my Blog Post --> www.SQLStudies.com[/url]

Viewing 15 posts - 451 through 465 (of 617 total)