Home > Microsoft SQL Server > Determin SQL Syntax from ODBC connection

Determin SQL Syntax from ODBC connection



How can you determine from the ADO/ODBC connection what identifiers are used in the SQL Syntax. <br>I want to know after the connection has been made to the database what I should encapsulate <br>column and tables names with that contain spaces, or : or - <br><br>E.g <br>MySQL uses backticks - SELECT * FROM `Table Name`<br>SQL Server uses [] or double quotes - SELECT * FROM [Table Name]<br> <img border="0" src="/forum/emoticons/roll.gif" height="15" width="50" alt="roll" />

    
Guest


You are probably better off setting a global variable in your application that defines what type of connection is being used than trying to resolve based on the connection. Of course, you could always attempt parsing the connection string as an option, but the varaible option would be quicker.<p><hr size="1" width="50%" align="left" />dotNetBB Forum Developer<br><b><i>Building A Better Community, One Post At A Time</i></b><br><a href="http://www.dotnetbb.com" target="_blank">www.dotnetbb.com</a></p>

Was this answer helpful ? Yes No   
Guest


Avoid problems like that. Not only is it a pain to type these syntaxes but also they cause pbs everywhere.



Name your tables with NO SPACES, no special characters (only the underscore)

Hence: use "a".."z" plus the underscore when naming tables, fields, databases...

nothing else

Was this answer helpful ? Yes No   
Guest
 
 
Home - About Infoqu - Contact - Privacy Statement - Link to Infoqu - Bookmark Infoqu

Copyright 2007-2008 by Infoqu. All rights reserved