Quoted Field And Escape Character Issue
Nov 8, 2006
I am attempting to import a flat file and have come accross and issue that I do not know how to fix in SSIS. The issue is that some of the text fields use quoted identifiers. This is not an issue in itself. The problem is they also use quotes as escape character if quotes are on the field.
So I see instances of "" because inside the quoted field is a quote. How do i specify an escape character?
View 1 Replies
ADVERTISEMENT
Nov 9, 2004
Hi Ya'll,
I tried searching for "escape character", "quotes", etc, but they didn't work.
I'm having troubling inserting data into my tables, if they have an apostrophe or double quotes. I know that MySQL's escape character is "", but I tried it for MS SQL and it didn't work. HOW DO I INSERT DATA INTO MY DB THAT HAS AN APOSTROPHE OR DOUBLE QUOTE? Thanks.
View 1 Replies
View Related
Feb 19, 2008
im having trouble getting this to work:
alter proc [ProGeneral_College_Structure] @Year nvarchar(4)
as
begin
DECLARE @SQLStatement nvarchar(1000)
Set @SQLStatement = 'SELECT School AS Level1Code, DIVISIONS.Div AS Level2Code,
DIVISIONS.ProgArea AS Level3Code, DIVISIONS.progName AS LevelName
, ' + SUBSTRING(@Year,1,2) + '/' + SUBSTRING(@Year,3,2) + ' AS AcademicYearID FROM DIVISIONS
WHERE (((DIVISIONS.[' + @Year + '])=1))
ORDER BY DIVISIONS.School, DIVISIONS.Div, DIVISIONS.ProgArea'
EXEC(@SQLStatement)
end
It's something to do with the / concatenation I think, is it an escape character or something tried // obviously and CHAR(47).
before I get comments I know it's dynamic sql and it's not great but I can't edit the divisions table so have to use a dynamic column.
View 11 Replies
View Related
Jan 25, 2006
I have a problem setting some variables in a package using the /SET option of dtexec. Specifically when the value I want to set contains a semi-colon. I get an error like:
Argument ""Package.Variables[User::Delim].Properties[Value];^;"" for option "set" is not valid.
I am guessing that I will have to escape the semi-colons somehow, but with what?
Regards,
Lars
View 9 Replies
View Related
May 30, 2008
Not sure if this is the right forums to ask this question..
I have a website in which i have a text box that has multiline = true... So suppose if if the user enter absbsbcjd and then hits enter and then again enter jfkdjf in my database i been stored as abscbabc twoboxes (new line) and then jfdkf and then sometime later i am taking that plan name and sending it as a subject to an email but since it has a new line character in that field.. i get an error..
so how can escape the new line character..
thanks
Karen
View 6 Replies
View Related
Aug 3, 2006
Hi!
Thanks For your reply!
but this is very urgent please help!!!!!!!
I need one more help in this issue. what if i do not need any "
for e.g: i am trying to set conn string and varaible value
jobCommand = new SqlCommand("xp_cmdshell 'dtexec /f "" + path + "" /Conn "" + Packconn + "" "" + connect + "" '",cconn);
i am getting some value like this :
CommandText "xp_cmdshell 'dtexec /f "D:\SSISProject\Integration Services Project1\ArchiveMainMultiTables.dtsx" /Conn "SE413695\AASQL2005.TestDB;" "Provider=SQLNCLI.1;Data Source=SE413695\AASQL2005;Initial Catalog=TestDB;Provider=SQLNCLI.1;Integrated Security=SSPI;" '" string
I do not need the highlighted escape characters in it. what should i do??????
i need some thing like this :
xp_cmdshell 'dtexec /f "D:SSISProjectIntegration Services Project1ArchiveMainMultiTables.dtsx" /Conn SE413695AASQL2005.TestDB;"Provider=SQLNCLI.1;Data Source=SE413695AASQL2005;Initial Catalog=TestDB;Provider=SQLNCLI.1;Integrated Security=SSPI;"'
Thanks,
Jas
View 2 Replies
View Related
Feb 20, 2007
Hi,another problem I have is that have compounded fields in my sql table.Exampleproduct@customerI need a simple function to return "customer", so it should return the valueafter "@", unfortunate "@" will sometimes be character number 6, sometimescharacter number 7 etc.regardsJorgen
View 1 Replies
View Related
Jul 20, 2005
I know there has to be a way to do this, but I've gone brain dead. Thescenario..a varchar field in a table contains a date range (i.e. June 1,2004 - June 15, 2004 or September 1, 2004 - September 30, 2004 or...). Theusers have decided thats a bad way to do this (!) so they want to split thatfield into two new fields. Everything before the space/dash ( -) goes intoa 'FromDate' field, everything after the dash/space goes into the 'ToDate'field. I've played around with STRING commands, but haven't stumbled on ityet. Any help at all would be appreciated! DTS?
View 1 Replies
View Related
Aug 1, 2004
In a SQL Server Db, what is the maximum amount of data a field can hold?
I am using right now nvarchar with a length of 4000.
Is there another setting to allow even more in a field?
Thanks all,
Zath
View 1 Replies
View Related
Jun 11, 2001
Does ORDER BY work on character data type in SQL Server through ODBC?
I tried using the SQL Query Tool in SQL Enterprise Manager and it works but using through ODBC I can't get any results.
Query: SELECT company_id, company_name FROM lt_company ORDER BY company_name
company_id = integer
company_name = 30 characters
View 1 Replies
View Related
May 2, 2006
Hello,I wonder how I can insert a string which contains #, as # is a specialcharacters in sqlThanks
View 1 Replies
View Related
Aug 2, 2007
HiI have a character field (char ot varchar) that I want to force only tocontain numeric characters.Can that be done by way of defining a constraint on the field ?or by any other way in the field/table definition ?What id the syntax ?Anyone have examples ?ThanksDavid Greenberg
View 1 Replies
View Related
Jul 20, 2005
I was wondering what everyone felt about the fomats in characterfields where the front end application accepts anything.I wouldn't want a customer table where the customer name was lowercase on one, upper on another and who knows on the third.If character fields are not consistent, then formatting will have tohappen every time someone access the data for reporting - as anexample ...Thanks,Craig
View 1 Replies
View Related
Jul 6, 2007
here is my business/data object for some reason I only get the first character back, say value is Charlie, I only get C public string GetUserName(long UserId)
{
try
{
string userName;
DiscussionDB data = new DiscussionDB();
List paramlist = new List();
paramlist.Add(data.CreateParameter("@UserId", UserId));
paramlist.Add(data.CreateParameter("@UserName", "", ParameterDirection.Output, DbType.String, 20));
data.ExecuteNonQuery("dbo.Discussion_User_Name", ref paramlist);
userName = paramlist[1].Value.ToString();
return userName;
}
catch
{
throw;
}
}
ALTER PROCEDURE [dbo].[Discussion_User_Name]
@UserId bigint,
@UserName varchar(20) output
AS
SET NOCOUNT ON
SET @UserName = (Select [Name] from Discussion_Member WHERE UserID = @UserID)
if (@UserName is null or @UserName = '')
BEGIN
SET @UserName = (Select UserName from Membership_User WHERE UserID = @UserID)
END
View 6 Replies
View Related
Dec 28, 2004
I have a 6 char field which has to be converted to a datetime. I thought I had it solved when I did this
convert(datetime,(left(dob,2)+'-'+substring(dob,3,2)+'-'+right(dob,2)))
Problem is with a date value of 081649
I get 08/16/2049 instead of 1949, where did I goof
View 1 Replies
View Related
Jan 29, 2007
Hi,
I am getting a date string that is contained in a character field (char(20)).
An example of the data is as follows:
2005-09-20121315001
it is in the format YYYY-MM-DDHHMMSSMMM.
I want to insert this value into a datetime field. I have used convert, but can only insert it when I split out the time portion and separate them with a colon
i.e. to get it to insert into a datetime field the data has to be in the following format
2005-09-20 13:15:18.001
YYYY-MM-DD HH:MM:SS.MMM
Is there a style parameter in the convert function that will allow me to insert this value without having to separate the hours/minutes/seconds with a colon? I have tried BOL but it seems that all the examples have colons in them where there is a time portion to the date,
Thanks in advance
View 1 Replies
View Related
Nov 9, 2005
Here's a question for the SQL gurus out there:
I have a varchar(20) field DIAGNOSISCODE in a table that can either be null, or contain up to 3 comma-separated codes, each of which relates to a description in another table. For example, some sample rows might be
8060
8060,4450
8060,4123,3245
Now I need to structure a query to return these values from this single field as three fields CODE1, CODE2, CODE3, with NULL as appropriate for example
CODE1=8060, CODE2=4450, CODE3=NULL.
I have been using CASE along with CHARINDEX and PATINDEX but it it becoming extremely messy. Can anyone think of a "neater" way to return three fields from this one field?
Any help very greatly appreciated.
Thanks, Simon.
View 5 Replies
View Related
Jan 1, 2015
I have one table and this field is character field with save data in below.
Bonus_table->bonus_amt_field. Char(20)
======================================
Record information
0
Null
Blank
3
4
Null
Blank
if i want to convert this character field => change to numeric field to display ,how to handle "Blank" and "null" record?
The result expect:
0
0
0
3
4
0
0
I try this query but wrong message :
select cast(convert(numeric,3)bonus_amt) as bonus_amt
from test
View 2 Replies
View Related
Mar 24, 2008
Hi, I need to replace a character from a column of a txt file. I have defined the column and the values (datetime type for sql server) that I receive are like this: 2008-02-15-20.07.19
So, I need to replace the "." with a ":" beacuse those are minutes and sql server uses ":" for minutes
How can I do this? Any help?
Thanks
View 9 Replies
View Related
Nov 22, 2005
I need to update the string in a longtext field. NewString = "This is a 'test'"
I can't figure out how to use an escape character to identify the string with " ' " and then also include the " ' " character inside the string.
Can anybody help me?
Thanks,
Alex
View 5 Replies
View Related
Sep 17, 2015
How to modify values in a SQL Database. In the table PRDDEmpmaster there is a field called email_address, and for those fields that have a value I need to change that value to add { } opening/closing "curly braces" to that field.
For example,
RPARSONS@YAHOO.COM becomes
{RPARSONS@YAHOO.COM} . Nulls/empty fields remain as is.
View 6 Replies
View Related
Apr 25, 2008
Hello:
I have a field hold varchar. I would like to calculate how many character in the field when user enter the data and save in the database.
Is there any way to do?
Thanks,
Snow
View 3 Replies
View Related
Jul 25, 2001
I am getting a data loaded in a DB table to a character field padded from the right with hexadecimal zeros 0x00. How to get rid of it?
Thank you.
View 3 Replies
View Related
Dec 8, 2014
Because of a limitation on a piece of software I'm using I need to take a large varchar field and force a carriage return/linebreak in the returned sql. Allowing for a line size of approximately 50 characters, I thought the approach would be to first find the 'spaces' in the data, so as to not split the line on a real word. achieve.
--===== Simulate a passed parameter
DECLARE @Parameter VARCHAR(8000)
SET @Parameter = (select a_notes
from dbo.notestuff as notes
where a_id = '1')
[Code] .....
View 5 Replies
View Related
Dec 4, 2007
I want to insert a value which has the UTF-8 encoding into a field of the database which has the "text" data Type
but it saves like this : " ?????????????? "
I would be thankful if u tell me how should I save it ?
here is the SqlComand I wrote :
string comand = " Insert into Table1 ( title , Body ) values ( ' " + textBox1.text + " ' , ' " + textBox2.text + " ' ) " ;
Table1
=============
title nvarchar(1000)
body text
View 4 Replies
View Related
May 14, 2003
During Index Rebuild, I get the following error:
"DBCC failed because the following set options have incorrect settings: 'Quoted_Identifier'"
Any ideas what might be causing this?
Thanks,
Ken Nicholson
View 8 Replies
View Related
Sep 26, 2006
There have been some posts on the difficulties of handling csv with quoted identifers.
I heard there were some custom components that aid in dealing with these as input files.
IYO, what do you consider to be the best way to deal with csv with quoted identifiers as an input to an ETL operation?
Also, if you know of any bloggers making quality (hopefully free) custom components?
Thanks!!
View 1 Replies
View Related
Oct 2, 2006
We have several sp's created to support a 3rd pary app that uses crystal inside the app with an odbc connection. We got sql row errors on any Citrix server where Use ANSI quoted identifiers was not checked. If we had them checked it works. Does this mean the sp's were created with the identifiers on and this is causing the issue?
View 1 Replies
View Related
Nov 2, 2005
I'm dumping data from a table via BCP and when BCPing them back in to another table, it errors out on numeric and date fields. I'd like to place quote marks on the text fields. How do I do this using BCP?
View 4 Replies
View Related
Jul 23, 2005
We're trying to use DTS from SQL Server 2005 beta 2 to query datafrom an Informix IDS server via OLEDB.Unfortunately DTS is building queries of the form:select * from "database":"owner"."tabname"and the quoted table name is being rejected by the Informix server as asyntax error.Is there a way to keep DTS from quoting the table name in queries? Or isthis happening within the OLEDB provider?Thanks.--John HardinDevelopment and Technology group (Seattle)CRS Retail Systems, Inc.
View 1 Replies
View Related
Aug 8, 2005
Hello everyone,SQL Server 2000. I have a database in which there are several objectswhich have ansi nuls and quoted identifier turned ON. Is there a way Ican generate a script which:(1) Can identify all objects within the database that have those twoproperties turned ON and(2) Change the properties for these objects and turn the ansi nulls andquoted identifier OFF for those objects.I am trying to avoid going throuh gazillions of objects and manuallydoing this.Thanks for any help.Raziq.*** Sent via Developersdex http://www.developersdex.com ***
View 17 Replies
View Related
Jan 16, 2003
Hi,
If you run the following code on 7.0 server, it will send a test file in csv format.
--*********************************
create table ##temp1
(tmp varchar(15))
insert into ##temp1
select 'Erin, Brockowich'
declare @cmd varchar(255)
select @cmd = 'select * from ##temp1'
EXEC master..xp_sendmail
@recipients = '<email>', --change to your email
@query = @cmd,
@subject = 'test-test',
@attach_results = 'true',
@attachments = 'test.csv',
@width = 800
drop table ##temp1
--**********************************
When you receive an email and double click on te attachment, it will launch excel automatically and put 'Erin' and 'Brockowich' in seperate columns. which is good and that is the way I want it.
But if I run this code on sql 2000 server, it will generate a file with 'csv' extension unrecognizable by excel. If you open this 2000 attachment in notepad, you can see that the data looks like
"Erin, Brockowich" (vs Erin, Brockowich without quotes on 7.0 server ), no wonder it is unrecognizable by excel.
I have set quoted_identifier off while compiling all the user sps on 2000 server. But while sending emails from within the procedure, all the attachments still generated with quotes.
How can I get rid of the quotes? We have at least 45 routines running generating coma seperated files as a result of the query and sending emails to the clients for years. Now all of a sudden all the routines got messed up with 2000 upgrade.
Can you suggest any work around?
Thanks,
Shaili
:confused:
View 1 Replies
View Related
Jul 27, 2006
Hello,
I am trying to insert quoted strings into a database table, however, I cannot remember how to do so. For instance, I am trying to insert the following values into a SQL table:
My Friend's
"Happy Birthday"
exactly as they are listed. How can I do that in a SQL insert statement?
Thanks,
Crystal
View 1 Replies
View Related