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 Wanet Telecoms Ltd 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: *

  1. SQLJoe

    Looking for wildcard characters as literal strings

    Oops, I should have caught that. Wasn't paying attention. Thanks!
  2. SQLJoe

    Looking for wildcard characters as literal strings

    Thanks both for the valuable info, but I'm still having issues. I've changed my syntax to: where documentname like '%[_]US[_]%[_]%[_]%.pdf' But curiously, this doesn't pick up document names such as '5_US_KR_08_12.pdf' (the single quotes are actually part of the string) But when I pare it...
  3. SQLJoe

    Looking for wildcard characters as literal strings

    How can I search for literal wildcard characters in a string? For example, SQL interprets an underscore as any single character, but I need to find an actual underscore character. I need to find strings matching this format, where ONLY the % sign is a wildcard: %_US_ %_%_%.pdf Thanks!
  4. SQLJoe

    Concatenating a variable into dynamic SQL

    Thanks AceMan, that's a great technique!
  5. SQLJoe

    Concatenating a variable into dynamic SQL

    Thanks PHV! That ended up being why EOF was still true; ADODB interpreted * as part of the string, and so it found no records, but the query editor interpreted it as a wilcard, so it did. I changed the character from * to % in code and that solved it. Thanks again. :)
  6. SQLJoe

    Concatenating a variable into dynamic SQL

    batch_key is a string: nvarchar(100). (I know earlier I said it's not an ADP file, but I do connect with a sql db via odbc, in addition to local Access tables.)
  7. SQLJoe

    Concatenating a variable into dynamic SQL

    I should add that, before I realized I needed to use the 'Like' with the wildcard and was still running sql without it, the command object and recordset were returning data just fine and I haven't changed them since. I'm looking things over again.
  8. SQLJoe

    Concatenating a variable into dynamic SQL

    ...it looks like I've got the right syntax now, but I'm not quite out of the woods. This is what it resolves to in the immediate window: SELECT * from qryDF24 where child_key like '*GC8871*' and batch_key = '218521'; Here's the catch (which leaves me befuddled...): After the command object...
  9. SQLJoe

    Concatenating a variable into dynamic SQL

    Thanks PWise, but unfortunately it's not an ADP file. Otherwise my life would be much easier! :)
  10. SQLJoe

    Concatenating a variable into dynamic SQL

    ...'Dynamically build query string If strDF = "10" Or strDF = "17" Then 'strSQL = "SELECT * from qryDF" & strDF & " where n_child_key like '*" & strChildKey & "'*" & " and batch_key = " & "'" & strBatchKey & "'" & ";" 'strSQL =...
  11. SQLJoe

    Concatenating a variable into dynamic SQL

    ...variable. I'm having issues getting the quotes and wildcards placed correctly. For example, I need to build a select statement such as Select * from QueryName where CodeField like "*SC12345*" I have to use "like" with the wildcards because the code may only be part of a longer string in...
  12. SQLJoe

    Counting Commas in a String

    I have a string of alpha-numeric codes separated by commas and need to count how many commas are in the string to determine how many codes are listed (one more than the number of commas). I know instr() will return the first instance of a character, but how can I count how many of them? For...
  13. SQLJoe

    Selecting the Penultimate Record

    ...seems unnecessarily complex. If I can just compare each row with the next-to-last one having the same donor/fund in the last 31 days, I can avoid all this hoop jumping. **Please note that this cannot be done in a sproc because the software using this data source can only use tables or views.
  14. SQLJoe

    Sproc Loads No Data, But No Error Either?

    Got it! Very helpful. Thanks both!
  15. SQLJoe

    Sproc Loads No Data, But No Error Either?

    My sproc (below) is supposed to load the data from a table that is passed to it into a table called tblPrintLog. It does not err out, but it does not load any data either. It just shows "(0 row(s) affected)". In the test table I'm using, there are 108 rows. What am I doing wrong? As an...
  16. SQLJoe

    Looping Through All Table Names in a DB

    Oops, please isregard my former comment. With all your help, I got it now. Thanks!
  17. SQLJoe

    Looping Through All Table Names in a DB

    This is good information, but I'm running this in a project, so I can't run a query like this because it tries to run it against sql server. What would be the code equivalent? Thanks!
  18. SQLJoe

    Looping Through All Table Names in a DB

    I need to automatically load the contents of a number of tables into a single table. I'd like to set up a loop that iterates through a list of all the table names, tests each name to see if it follows a certain naming convention, and if it does, append the contents into another table. I can do...
  19. SQLJoe

    Selecting one row for each id

    Works great, thanks!

Part and Inventory Search

Back
Top