jchristn / DatabaseWrapper

Simple database wrapper for Microsoft SQL Server, MySQL, PostgreSQL, and Sqlite written in C# supporting dynamic query building and nesting using expressions.
MIT License
97 stars 26 forks source link

Table name must have either zero or one period #5

Closed Vaelek closed 3 years ago

Vaelek commented 3 years ago

Table name must have either zero or one period

I received this error today while trying to make use of this wrapper. I am attempting to use a fully qualified table name thus making use of multiple databases on one client. This would generate perfectly valid SQL and seems an arbitrary limitation imposed by this library.

jchristn commented 3 years ago

Hi @Vaelek it was primarily imposed to allow for the schema to be included in the database name. You have tables with names such as abc.def.ghi?

Vaelek commented 3 years ago

@jchristn I have about 6 databases on my server. Regardless of which is the "default" for the connection, in other tools (SQL Server) I can query whichever I like in the form of DBName.Schema.Tablename. Even going a step further if I wish to query a linked server, as Servername.DBName.Schema.Tablename. As it is here it would seem my only option to accomplish that would be to maintain 6 different connections.

jchristn commented 3 years ago

Try this and let me know if it works for your case. NuGet: https://www.nuget.org/packages/DatabaseWrapper.SqlServer/3.3.1.3 Commit: https://github.com/jchristn/DatabaseWrapper/commit/c34a513e9ed53584c29f0aa3f66733c1c7c2f5d8

Vaelek commented 3 years ago

Yessir that seems to do it!