SQL Recipes
A FREE cookbook for SQL queries and examples
Register FAQ Search Today's Posts Mark Forums Read

SQL - Questions and Answers Have a SQL question? Post it here. First do a search to see if someone hasn't already answered it.

Go Back   SQL Recipes a FREE cookbook of SQL queries and examples > SQL queries and examples > SQL - Questions and Answers

Reply
 
LinkBack Thread Tools Search this Thread
  #1 (permalink)  
Old 06-25-2007, 02:07 PM
Unregistered
 
Posts: n/a
Default ANY dialect question:

How to know column type


Hi all:

I want to know if there is a SQL statement that allows me to know the type of each column (string, integer, boolean, float, date,etc.) in a table. I'm using ODBC for a MSAccess database.

Thanks
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

ANSWER(S):

  #2 (permalink)  
Old 06-28-2007, 01:41 PM
Sorcerdon Sorcerdon is offline
Junior Member
 
Join Date: Jun 2007
Posts: 1
Sorcerdon is on a distinguished road
Default ANY answer. Re: How to know column typ

Quote:
Originally Posted by Unregistered View Post
Hi all:
I want to know if there is a SQL statement that allows me to know the type of each column (string, integer, boolean, float, date,etc.) in a table. I'm using ODBC for a MSAccess database.
Thanks
Code:
sp_columns 'tableNamehere'
Dont use dbo.tableName
Just use the tableName.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 06-29-2007, 10:58 AM
Unregistered
 
Posts: n/a
Default ANY answer. Re: How to know column type

Hi:

Thanks for your answer. Unfortunatelly when I tried to do it, there was an error message saying: SQL instruction non valid. The system expected 'DELETE', 'INSERT', 'PROCEDURE', 'SELECT', or 'UPDATE'. I',m using the Microsoft Access Driver vs 4.0. BTW: in my application we are not using any other server than the ODBC administrator that WinXP has.

Is there another option to get this info using the basic SQL commands (independent of any db engines)?

Thanks for your help and best regards
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 06-29-2007, 09:31 PM
Dimitar
 
Posts: n/a
Default ANY answer. Re: How to know column type

Quote:
Originally Posted by Unregistered View Post
Is there another option to get this info using the basic SQL commands (independent of any db engines)?
This information is stored in the so called 'Information Schema', in engines who support it. Information schema is part of the ANSI SQL specification, but generally speaking not a mandatory one.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 06-29-2007, 09:36 PM
Dimitar
 
Posts: n/a
Default ANY answer. Re: How to know column typ

If I were you I would look for 'meta data' features in ODBC.
Hope this helps,
Dimitar
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 07-05-2007, 11:00 AM
Unregistered
 
Posts: n/a
Default ANY answer. Re: How to know column typ

Hello, thanks for your comments. Finally I have found a software code to access this kind of meta information using a QT (trolltech) widget.

Best regards
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 08:42 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0
Copyright (c) 2006-2008 SQL Recipes

1 2 3 4 5 6 7 8