Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search results for query: *

  • Users: Qmoto
  • Order by date
  1. Qmoto

    How do I write this type of query?

    bborrisov: Grr! My code example is right but I miss typed the statment after the code - sorry for the confusion there! gmmastros: adding the min() solves the problem - thanks for the tip! Now, if I understand what's going on in this code... the select statement is checking oC.Id and oC.Fld2 to...
  2. Qmoto

    How do I write this type of query?

    Thanks for the reply borrisov, I appologize for the slow reply! The code you gave me fullfills points 1, and 2 in my question, but I'm still not sure how to take care of point three. By adding a fourth record to the @orders_historical table the query returns a duplicate Fld2 value. How do I...
  3. Qmoto

    How do I write this type of query?

    The select statement I'm using to create my view has about 4 joins to get to various files that I need, however, there are two main files that I am pulling data from. One is the orders_current [ oC ] and the other is orders_historical [ oH ]. Here's what I need to do: If I find a record in [...
  4. Qmoto

    10 Character date field (I've tried cast & convert) ...

    I'm not sure how they are bringing the data in... that's part of the problem. We're going to schedule another meeting to talk with them about this and other issues. Thanks again for all your help, Steve
  5. Qmoto

    10 Character date field (I've tried cast & convert) ...

    Unfortunately, they want option 1 So, I guess that confirms my suspicion that I now have to place the ball back in their court. Thanks for the help!
  6. Qmoto

    10 Character date field (I've tried cast & convert) ...

    Thanks for the responses - sorry my reply is so slow! gmmastros - I like that Idea, I think I'll implement the Nullif code. It will help shorten my current t-sql a bit and teach me a new trick at the same time! :0) Alex - from what I've seen, you are correct, the datetime format always gives...
  7. Qmoto

    10 Character date field (I've tried cast & convert) ...

    Thanks for taking a look at my question. I'm sending data to corporate for analysis by their programmers, However, this past Friday I received the following email (emphasis supplied by me). Here's the problem: The code I'm using was nicely provided by gmmastros over on Link: this thread...
  8. Qmoto

    Strip special characters like [ ¿ · } ]

    Wow! That was quick and simple! ... sad. I've been struggling with this all morning. *sigh* but my ordeal is now over. Thanks a million! [have a star]
  9. Qmoto

    Strip special characters like [ ¿ · } ]

    I should also mention that removing the wildcard character (in blue) does not change the results. CASE WHEN LEFT(C6B9CD, 2) LIKE '¿·' THEN REPLACE(C6B9CD, '¿·', '') WHEN RIGHT(C6B9CD, 1) LIKE '}' THEN REPLACE(C6B9CD, '}', '') ELSE C6B9CD END AS SHIPTO_KEY
  10. Qmoto

    Strip special characters like [ ¿ · } ]

    Hello Again, I've got some special characters I need to strip out of a field but there are a few rows that do not seem to be affected. Actually, I should say that I have it 90% working, but there are some records with a trailing curly bracket ( } ) that will not leave... *sigh* Ok, here's a...
  11. Qmoto

    Float to 2 decimal positions

    Try this... CAST(AmountField AS DECIMAL(10,2)) AS AMOUNT or CAST(AmountField AS NUMERIC(10,2)) AS AMOUNT I think that should do what you're looking for. Just change the (10,2) to whatever precision you need. Cheers!
  12. Qmoto

    Msg 8114, Level 16, State 5, Line 1

    Thanks for the help guys! I went through and found several gotchas, once I cleaned those up and CAST some of the fields to the required lengths the query works like it should. ps - I really do apologize for such a long code post that's not normally my style, but it appears to have helped in...
  13. Qmoto

    Msg 8114, Level 16, State 5, Line 1

    Sorry, I wouldn't normally post this much code, but you asked for it... :0) It's fairly long, but here goes: IF EXISTS (SELECT TABLE_NAME FROM INFORMATION_SCHEMA.VIEWS WHERE TABLE_NAME = 'ORDER_DATA_C') DROP VIEW ORDER_DATA_C; GO CREATE VIEW ORDER_DATA_C AS SELECT /* OPEN ORDERS */...
  14. Qmoto

    Msg 8114, Level 16, State 5, Line 1

    Hello Everyone, I'm trying to combine a view for current orders, and a view for historical orders. The view is created without error, but when I try to query the view I get the following error. The interesting thing is that if I create the views (current / historical) seperatly the query works...
  15. Qmoto

    Which is Faster: Left(), Substring(), or Cast()

    WARNING: LONG (AND WIDE) POST It appears that the results are similar, although I didn't drop the tables each time because I uped the iterations to 150000, which gave me 2,849,981 million rows (closer to the particular view I'm working with). Even though there were 2.8 million rows, the...
  16. Qmoto

    Which is Faster: Left(), Substring(), or Cast()

    Hmmm very interesting... thanks for the test data, let me play with it for an evening and see what I can come up with. I appreciate the help.
  17. Qmoto

    Which is Faster: Left(), Substring(), or Cast()

    Thanks Alex, This is actually going to be used in a view, more specifically on a zipcode column on a join in a view. Confused yet... :0) Here's the code I'm using LEFT JOIN ZIPFILE ZIPF ON MBAL.ALCPTX = ZIPF.CITY AND LEFT(MBAL.ALCVCD, 5) = ZIPF.ZIP5 The column being trimmed to 5...
  18. Qmoto

    Which is Faster: Left(), Substring(), or Cast()

    I'm working with a smallish recordset of just over 2 million records. In order to select the correct information, one of the select statements needs only the 5 leftmost characters. Currently I'm using LEFT(col3, 5) Does anyone have any advice as to which of the three methods would be faster...
  19. Qmoto

    Convert cyymmdd to mmddyyyy

    Oops! I was playing with your code to see what would happen if I took out one of the convert's. the correct code should read... ,CASE WHEN MBF9.FEGHNB = '0' THEN '0' WHEN MBF9.FEGHNB <> '0' THEN CONVERT(VarChar(10), Convert(DateTime, Convert(VarChar(8), MBF9.FEGHNB + 19000000))...
  20. Qmoto

    Convert cyymmdd to mmddyyyy

    You are quite correct, I found 3972 items where the original row value was '0'. I used the following code to fix the problem, and hopefully this 'help request' is put to bed. ;0) CREATE VIEW INVOICE_DATA AS SELECT 'LOCATION' AS BU_KEY ,CASE WHEN MBF9.FEGHNB = '0' THEN '0' WHEN...

Part and Inventory Search

Back
Top