Click here to Skip to main content
15,895,011 members
Please Sign up or sign in to vote.
3.67/5 (2 votes)
See more:
Hello All
I am not sure my question has answer!
I have a MYSQL table with a date column. I want get it in C# as string not MYSQL date time
but matter is I don't know column Name.I know how do it if know column name
SQL
SELECT DATE_FORMAT(X, '%Y/%m/%d') AS  X FROM Y  

but i don't know how do it when i don't know column Name?
Posted

I assume you know the table name, then you can find out the table structure with column names and their data types:
SQL
show columns from databasename.tablename; 
 
Share this answer
 
v2
Comments
ali majed 21-Jan-14 10:13am    
thanks for Reply
select convert(varchar(50), x) as x from y

if date column is null then use this,

select isnull(convert(varchar(50),x) , '-') as x from y


if its works, then plz accept it n assign rates.


thnx
 
Share this answer
 
Comments
ali majed 21-Jan-14 10:18am    
thank for your replay
but i don't know column name i.e X

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900