Web Design Resources Blog Logo: Offering The Best of the Web Links to Graphic Design, Web Design, and Graphics Websites and Resources in a Web Blog Journal all web design resources bottom number 2

Web allwebdesignresources.com
contact all web design resources top number 3
all web design resources bottom number 1 all web design resources bottom number 2 all web design resources bottom number 3

AllWebDesignResources.com is the Web Design Directory & Blog of the Graphic Design Resources Directory Listing The Best of Web Design Resources, Tools, Graphics Software, Web Design Websites, Reviews, Articles, Commentaries, Advice, & Tutorials on Web Design & Development Topics.

contact allwebdesignresources.com contact allwebdesignresources.com
Graphic Design Resources Ads Separator - Graphic Design & Graphics Templates Below this Arrow
home > Web Design Tutorials > Programming Tutorials > ASP Coding Tutorials > ASP AND SQL DATABASE TUTORIALS  
 

ASP AND SQL TUTORIALS : ASP SQL DATABASE TUTORIALS

How do I deal with an apostrophe (') in a SQL statement? - The apostrophe is an illegal character in T-SQL because it is interpreted as a string delimiter. To allow a ' mark to be inserted into a database, simply double-up all occurences of the ' mark:

SQL Test
- For every web database project I work on, I pop this code somewhere onto the server. This page allows me to test out SQL queries before I put them into my ASP code.

Generate SQL Statements using easy interface - Make a simple interface to generate SQL Statements which can be copied and pasted into your ASP code. This is not ment to support crazy queries, or advanced SQL, but more to serve as a way to speed up mundane coding.


ASP 101 - Using Quotes in Your SQL Commands - SQL uses a single quote (') character to mark the beginning and end of a string. As such, using a string that contains a quote can cause errors because your database thinks the string is finished and expects SQL commands to come immediately after it.

What is wrong with 'SELECT *'? - SELECT * is inefficient, particularly when you are only using a few of the columns in the table. This is because it actually makes TWO queries to the database: before it runs your query, it has to query the system tables to determine the name and datatypes of the columns. It is much more efficient to NAME your columns in the SQL query, and this will also help in having your column names right there... so you don't have to keep flipping back and forth between ASP page and database. In addition, this will prevent ambiguous column names in your resultset (in the case where both or all tables in the JOIN statement have columns with the same name). Further still, your code can break if it relies on ordinal position, and then someone inserts a column at the top of the table (which you can do in Enterprise Manager, or by dropping / re-creating the table). This is also a strong case for always defining columns in the INSERT list.

Which is better, rs(0) or rs("column_name")? - It is marginally faster to perform recordset element lookups by ordinal position (e.g. rs(0) or rs(0).value) vs name (e.g. rs("column_name")).

How to search and replace SQL Server data in all columns of all tables, in a given database? - This is one of the common requests I see in the newsgroups. People often wonder how they could search and replace data, that is stored in their tables. While this doesn't sound like a very good thing to do, there are some genuine situations, where 'find and replace' functionality is needed. For example, spelling mistakes in the column values, or moving a database from one location to another, and wanting to replace all location specific content.


Codefix - The Apostrophe Bug - In an SQL statement text is enclosed by an apostrophe at the start and an apostrophe at the end. Consider the SQL Insert statement below.

Removing single quotes for SQL statements - One of the most common problems in submitting web forms to a database using SQL is the dreaded single quote. The database reads single quotes as part of the syntax of the SQL query and invariable produces an error.

 

SUBMIT YOUR WEB DESIGN, GRAPHIC DESIGN, or FREELANCE ARTICLE or TUTORIAL

We are looking for quality submissions of Web Design, Graphic Design, Freelancing, and Small Business Articles & Tutorials. Our network of sites gets about 20,000 visitors per day. If you are interested in promoting yourself or your business, then this is a great way to do so. We might also use it in our Graphic Design Blog and our Web Design Blog. Please submit your articles to us. You can send us your article in MS Word Format or HTML. Please email us with any questions.

BOOKMARK THIS PAGE! :: MAKE US HOMEPAGE  :: SIGN UP NEWSLETTER :: ADD PORTFOLIO FREE :: DESIGNER JOBS :: FREELANCER JOBS

OUR FRIENDS -- Adobe Photoshop Tutorials --Photoshop, Flash, 3D Studio Max Tutorials --Photoshop Tutorial Man -- Tutorial Guide -- Free Webmaster Tutorials -- AllFreelanceWork--AllFreelance--Artists Helping Children -- All Creative Portfolios -- All Work at Home Ideas

R E L A T E D . L I N K S

All website design, text, graphics, selection and arrangement thereof, and software are the copyrighted works of Allfreelance, © Copyright 1997-2006. Contact Us