473,789 Members | 2,032 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Characters not allowed in SQL varchar?

Plater
7,872 Recognized Expert Expert
I have been using MS SQL server (8.0.194) and I have been wondering whatacters should I strip from entries before putting them into a varchar() field?

I check for single quote (') and handle that, and malicious attempts. But is it ok to have the newline characters in there(\r\n)? The always show up as the ASCII-square box, so I was wondering if I need to be stripping them out as well?
What other "normally used" text characters do I also need to watch out for, if any?

Thanks.
Jun 15 '07 #1
1 27834
DKelley
7 New Member
I wouldn't think it would matter what you "put into a varchar" as long as when you "pull" the text back out you DISPLAY it in the same manner from where you saved it. That is, if you used a simple text box for a line of entry then it likely won't matter. But if you use a Rich Text Box for input, then you should use a Rich Text Box for output once the data is retrieved from the database, Newline characters and all. Even a single-quote won't matter as long as your ADO objects are written to allow single-quotes w/out needing to use escape characters or methods (such as double-single-quotes, or \', or whatever).

Otherwise, don't use a Rich Text Box or input or use simpler ASCII codes, if you are building a string, such as {Carriage Return} {Line Feed} rather than {Newline}.

Hope that helps.
Jun 18 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
4864
by: cliverama | last post by:
help! fried brains.... asp calling a sqlserver7 stored proc which dynamically builds a sqlstatement & passes it to sp_executesql asp page gives the operation not allowed when object is closed error this is the asp code: Set connInc= server.CreateObject("ADODB.Connection") connInc.Open "DSN=db_database;User ID=userid;Password=xxxxxx" Set rsInc= server.CreateObject("ADODB.Recordset")
17
2729
by: James Baker | last post by:
I'm getting an error: "Operation is not allowed when the object is closed." on the lines of code below. I can't imagine why the object would be closed where it says it will be, I've just opened it on the line before. This is all within a larger loop, but the loop seems to be working fine and other insert statements within it seem ok. Any suggestions? Dim cmsRS, cmsSQL Dim insRS, insSQL Set cmsRS =...
0
3119
by: Thomas Finninger | last post by:
i want to use mysql for logging perposes ... the database will be accessed by a third party product using ODBC the problem: i'll have to create some columns with special characters in the column names example: create table PacketFilterLog (
2
2661
by: Remco van den Berg | last post by:
I'm running a MySQL database with one of tables holding the members of a volleybal club in the Netherlands. One the the fields in that table is holding the name of the players. How do I search for all people with the name "Andre", with the important remark, that it should also match "André"!! So with the letter "e" with an accent "'" on it. In the Netherlands those names can be spelled with and without the accent and I do not always...
7
8802
by: Philip Kofoed | last post by:
Greetings, I have a SQL server 2000 running on an english win2000 workstation. In a database I have a table where one varchar column is set to polish collation. Regional settings for the system is polish. Data entered in a client application looks fine until they are posted. When reading the data with the client application, the special polish characters are incorrect, they appears as e.g. '1' and '3'. The strange thing is that when I...
2
3022
by: Adam | last post by:
I am importing a table from Informix into Access XP via an ODBC connection. In one of the fields, I will need it to allow 4000 characters. In Access help, it shows the data type can be changed to "memo" and that will allow up to 65,535 characters. After importing the table, I checked the data type and it automatically was set to memo, but with the 255 character limitation. When I attempt to go over 255, it will not allow it. Does...
13
13962
by: mike_dba | last post by:
I am having some data reject on an insert of Japanese characters to a Varchar column in my DB2 UTF-8 database. I am trying to understand how big to make the Varchar column for the inesert to work successfully for all of my data. I would also like ot understand if Vargraphic is a better approach and what ramifications that might have. This data is sourced from UTF-8 Oracle (using byte semantics) which defines a columns as...
9
3931
by: Nathan Sokalski | last post by:
I have several TextBoxes with TextMode="MultiLine" in which I want to limit the number of characters that can be entered using a RegularExpressionValidator. I have come up with the following ValidationExpression: {0,250} The only problem with this ValidationExpression is that it does not include the \n character as stated on the following documentation page:
1
10151
by: benfly08 | last post by:
Hi, guys. I just wonder whether a space within column name is allowed in SQL Server 2000(i.e. "Item Number" as column name). In a stored procedure i saw: Create table #temp (ExpiryDate varchar(255), "Item Number" varchar(255), "Description" varchar(255), Brand varchar(255), "Current Full Amt" varchar(255))
0
9656
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9499
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10374
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9969
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8995
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6750
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5404
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3677
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2898
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.