Click here to Skip to main content
15,887,428 members
Home / Discussions / Database
   

Database

 
QuestionMS Access SQL: Turn rows into column Pin
Katvillan18-Aug-13 10:09
Katvillan18-Aug-13 10:09 
AnswerRe: MS Access SQL: Turn rows into column Pin
Mycroft Holmes18-Aug-13 11:45
professionalMycroft Holmes18-Aug-13 11:45 
QuestionOOP Pin
candz_kritz18-Aug-13 0:30
candz_kritz18-Aug-13 0:30 
AnswerRe: OOP Pin
Richard MacCutchan18-Aug-13 1:27
mveRichard MacCutchan18-Aug-13 1:27 
AnswerRe: OOP Pin
PIEBALDconsult18-Aug-13 5:21
mvePIEBALDconsult18-Aug-13 5:21 
AnswerRe: OOP Pin
Eddy Vluggen18-Aug-13 6:54
professionalEddy Vluggen18-Aug-13 6:54 
AnswerRe: OOP Pin
SaqibRasheed18-Aug-13 11:30
SaqibRasheed18-Aug-13 11:30 
QuestionMySQL view definition oddity Pin
PIEBALDconsult15-Aug-13 8:01
mvePIEBALDconsult15-Aug-13 8:01 
Much of my current job involves combining data from various sources into one SQL Server database. One of the sources is a MySQL database and I have noticed something odd.
One of the first steps I take when I get access to a new data source is to investigate the schema. As a fan of ADO.net and database-agnosticism, my main tools for doing this are:
System.Data.Common.DbConnection.GetSchema() , System.Data.Common.DbConnection.GetSchema(string) , and System.Data.IDataReader.GetSchemaTable()
which every compliant ADO.net provider should implement.
The way I use GetSchemaTable is to cobble up a SELECT * FROM name WHERE 0=1 query for each table and view, call ExecuteReader, call GetSchemaTable, and display the results.
The WHERE 0=1 clause is intended to keep the server from doing a bunch of needless work, but just return an empty dataset. This works, but I have since found that it hides problems -- mostly related to views that are out of sync with their sources. So I removed the WHERE clause and was surprised that one column in one of the MySQL views was reported as Int64 rather than Int32 as it is when I use the WHERE clause.
I got the latest version of the MySQL Connector/net and the situation persists.

What I then found, by using GetSchema("VIEWS"), is that the column is defined like IF((id IS NOT NULL),id,NULL) AS 'id' (id is involved in a JOIN among several tables).
I don't have access the tables so I don't know what type the actual field is. And I see comments on the Web that IF can return unexpected types. I have been unable to reproduce the oddity in my own test database.

But my question is, "why use the IF function in this case?" How is this better than just returning id whether it's NULL or not? Is there some historical reason?
AnswerRe: MySQL view definition oddity Pin
Jörgen Andersson15-Aug-13 8:44
professionalJörgen Andersson15-Aug-13 8:44 
GeneralRe: MySQL view definition oddity Pin
PIEBALDconsult15-Aug-13 10:21
mvePIEBALDconsult15-Aug-13 10:21 
GeneralRe: MySQL view definition oddity Pin
Jörgen Andersson15-Aug-13 11:02
professionalJörgen Andersson15-Aug-13 11:02 
GeneralRe: MySQL view definition oddity Pin
PIEBALDconsult15-Aug-13 11:16
mvePIEBALDconsult15-Aug-13 11:16 
QuestionTranslating Access SQL Statement to T-SQL Pin
Morore_Charles_00714-Aug-13 1:33
Morore_Charles_00714-Aug-13 1:33 
AnswerRe: Translating Access SQL Statement to T-SQL Pin
Richard Deeming14-Aug-13 1:58
mveRichard Deeming14-Aug-13 1:58 
QuestionSSIS Job - Proxy Login Failure Pin
lmaycock13-Aug-13 23:35
lmaycock13-Aug-13 23:35 
AnswerRe: SSIS Job - Proxy Login Failure Pin
GuyThiebaut14-Aug-13 0:09
professionalGuyThiebaut14-Aug-13 0:09 
GeneralRe: SSIS Job - Proxy Login Failure Pin
lmaycock14-Aug-13 8:51
lmaycock14-Aug-13 8:51 
QuestionSelect Statement in SQL Server Pin
KeithF13-Aug-13 22:37
KeithF13-Aug-13 22:37 
AnswerRe: Select Statement in SQL Server Pin
KeithF13-Aug-13 22:40
KeithF13-Aug-13 22:40 
AnswerRe: Select Statement in SQL Server Pin
GuyThiebaut13-Aug-13 23:00
professionalGuyThiebaut13-Aug-13 23:00 
GeneralRe: Select Statement in SQL Server Pin
KeithF13-Aug-13 23:20
KeithF13-Aug-13 23:20 
GeneralRe: Select Statement in SQL Server Pin
Richard Deeming14-Aug-13 1:54
mveRichard Deeming14-Aug-13 1:54 
GeneralRe: Select Statement in SQL Server Pin
KeithF14-Aug-13 2:01
KeithF14-Aug-13 2:01 
QuestionConnecting to a Database in SQL Server 2008R2 Express Pin
Bram van Kampen13-Aug-13 14:41
Bram van Kampen13-Aug-13 14:41 
AnswerRe: Connecting to a Database in SQL Server 2008R2 Express Pin
PIEBALDconsult13-Aug-13 16:24
mvePIEBALDconsult13-Aug-13 16:24 

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

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