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!
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...
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...
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...
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...
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...
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...
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...
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!
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...
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...
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...
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...
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...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.