Microsoft SQLServer columns and table names can have spaces.

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Microsoft SQLServer columns and table names can have spaces.

jashatton
Yeap, I know those crazy guys at Microsoft let you do this and I have a client I am working for that takes "advantage" of it.   I was thinking of patching DBUnit to support it because it currently doesn't especially with the way their JDBC driver works. Before I submit this possible patch is there another way to achieve this?

What I am seeing is the sql being generated by dbunit during an operations isn't considering spaces in table or column names.  Microsoft uses a square bracket notation to delimit the start and end of name.  These brackets aren't supplied by default or even by configuration through the JDBC driver.

Thanks,

Jas

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
dbunit-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/dbunit-user
Reply | Threaded
Open this post in threaded view
|

Re: Microsoft SQLServer columns and table names can have spaces.

diongillard
Is there a JDBC standard for this? How about double quotes around the
table name?

On 12/21/07, Jason Hatton <[hidden email]> wrote:

> Yeap, I know those crazy guys at Microsoft let you do this and I have a
> client I am working for that takes "advantage" of it.   I was thinking of
> patching DBUnit to support it because it currently doesn't especially with
> the way their JDBC driver works. Before I submit this possible patch is
> there another way to achieve this?
>
> What I am seeing is the sql being generated by dbunit during an operations
> isn't considering spaces in table or column names.  Microsoft uses a square
> bracket notation to delimit the start and end of name.  These brackets
> aren't supplied by default or even by configuration through the JDBC driver.
>
> Thanks,
>
> Jas
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2005.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> dbunit-user mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/dbunit-user
>
>


--
dIon Gillard
Rule #131 of Acquisition: Information is Profit.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
dbunit-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/dbunit-user
Reply | Threaded
Open this post in threaded view
|

Re: Microsoft SQLServer columns and table names can have spaces.

jashatton
In reply to this post by jashatton
I have looked for a JDBC solution to this and haven't had any luck.  If anyone finds one let me know I would certainly go for that option.  I have a patch working on DBUnit.  I have also found out from friends of mine that even Oracle allows for whitespace in table and column names.  Oracle uses the double quotes like you mentioned to delimit column names.  The only issue in Oracle with that is queries are case sensitive if you use it.  MS SQL Server uses square brackets for the delimiter.  I have verified though that double quotes will work with MS SQL Server.  Not sure if it would be wise to make an assumption that all RDMSs  follow that as a standard.  With all this considered this probably should be a feature of dbunit.  Even if the practice is a bad one in my opinion.

Jas

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
dbunit-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/dbunit-user