Click here to Skip to main content
11,805,035 members (55,552 online)
Click here to Skip to main content

Remove comment in SQL

, 12 Feb 2003 57.6K 366 16
Rate this:
Please Sign up or sign in to vote.
Remove comment in SQL to make it easy to execute with MS Access.


Your can write SQL which reads good, like this:

-- What the sql (et. stored procedure )writen for
-- and/or how to use it
/* Or block comment like this
   What the sql (et. stored procedure )writen for
   and/or how to use it
create table tablename (
    fieldname text(255), -- comment for field 
    content text(255));

Comments in SQL statements sent through ADO will sometimes error out in ADO when ADO tries to parse it. By stripping out the comments, you have both documented SQL code and you don't get any errors when you try to use the commented code within your ADO application. Then use these SQL saved in files directly!

How to use it?

Declare the function in any .h file of your project:

int ClearSQLComment(LPCTSTR lpSQL,CString &rString);

and use it:

CString strText,strSQL;
//Read all text from file to a CString object ,write it yourselft
//...Execute SQL 


This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

China China
No Biography provided

You may also be interested in...

Comments and Discussions

Generalthe best way to "remove" SQL comment Pin
Anonymous13-Feb-03 7:58
sussAnonymous13-Feb-03 7:58 
GeneralRe: the best way to "remove" SQL comment Pin
colison13-Feb-03 13:50
membercolison13-Feb-03 13:50 
GeneralRe: the best way to "remove" SQL comment Pin
Anonymous20-Feb-03 7:52
sussAnonymous20-Feb-03 7:52 
GeneralRe: the best way to "remove" SQL comment Pin
Terry Denham14-Feb-03 3:27
memberTerry Denham14-Feb-03 3:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.151002.1 | Last Updated 13 Feb 2003
Article Copyright 2003 by colison
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid