Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 True False in OPENDATASOURCE

Author  Topic 

sanjay5219
Posting Yak Master

240 Posts

Posted - 2014-11-10 : 09:10:42
Hi All,

Please see below syntax when I am running below query in the place of true and false it is showing 0 and 1.

Please suggest how to avoid this

Select * FROM OPENDATASOURCE('Microsoft.Jet.OLEDB.4.0','Data Source=D:\publish_overall\Report\Report1.xls;Extended Properties=EXCEL 5.0')...[Sheet1$] ;

gbritton
Master Smack Fu Yak Hacker

2780 Posts

Posted - 2014-11-10 : 09:20:41
1. Don't use 'SELECT *'
2. For the column that returns 0 and 1, in the SELECT statement write

SELECT ... -- columns before true/false column
CASE truefalsecolumn
when 0 then 'false'
else 'true'
END as truefalsecolumn,
... -- columns after true/false column

Go to Top of Page
   

- Advertisement -