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 strongm 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: SQLJoe
  • Content: Threads
  • Order by date
  1. 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!
  2. SQLJoe

    Concatenating a variable into dynamic SQL

    I need to dynamically build a select statement in code that concatenates a string parameter 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...
  3. 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...
  4. SQLJoe

    Selecting the Penultimate Record

    I have a table that tracks donations made by people to a variety of different funds. Information tracked includes a donor id, the fund id for what they donated to, the date of the donation, etc. Every day various mailings (using different templates for each fund) are sent out for all donations...
  5. 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...
  6. 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...
  7. SQLJoe

    Selecting one row for each id

    I need to be able to select only one row out of a table for each donor id present, even when the donor id is listed multiple times (once for each donation). For example, my data looks like this: donor1 fund_a amt_a donor1 fund_b amt_b donor1 fund_c amt_c donor2 fund_a amt_a donor3...
  8. SQLJoe

    Using SS2K8, but nvarchar(8000) invalid?

    I am running SQL 2008, but the database is not allowing me to set a length for nvarchar greater than 4000, even though all the documentation I've seen says it will accept up to 8000. I'm sure this is something simple I'm overlooking. My statement: alter table dbo.tblWPDataFile2 alter column...
  9. SQLJoe

    How can I join with data from a web service?

    I need to join data from a web service with data in a table. I have been told this can be done by writing a stored procedure that will talk to any non OLEDB data source and return a recordset, but I've never done this. Does anyone have an example? Thanks!
  10. SQLJoe

    Unicode Issue

    I am importing a pipe-delimited text file into a table, but special characters (accent marks, tildes, etc.) are getting changed into math or non-English characters. I thought SQL handled this automatically. Do I control that during import, or is there a server level setting that needs to be...
  11. SQLJoe

    Bulk Insert/Concatenating a Variable

    My code below is throwing errors (at bottom) but I don't know what the problem is. I'm just passing this procedure a string to concatenate onto the end of the directory in the FROM clause. Before I added the concatenation, the syntax checked out fine. I'm sure it's a pretty basic mistake. I...
  12. SQLJoe

    Dir() issues

    I need to select only the files in a directory where the first 9 characters in the file name match the values in a recordset, and copy these files to another directory. I've tried using two Dir()'s in short sequence (one inside a nested loop) to use alternately for the source folder and the...
  13. SQLJoe

    Bulk insert woes

    I'm having problems with the syntax of the statement below. It keeps giving me a truncation error, even though the datatype in the table (varchar) is plenty long enough. It's supposed to pull data from an excel file on a drive share. Any help is appreciated. BULK INSERT dbo.TableName FROM...
  14. SQLJoe

    S2K5 Not Liking my Bulk Insert Syntax

    Hi all, I'm having issues creating this procedure. It's not liking the "FROM @FilePath" clause and I don't know why not. The @FilePath variable includes the file name. Any help is appreciated. create procedure spImport @FilePath as varchar(200) as begin BULK INSERT dbo.tblGifts FROM @FilePath...

Part and Inventory Search

Back
Top