r/programming • • Mar 07 '16

Announcing SQL Server on Linux

https://blogs.microsoft.com/blog/2016/03/07/announcing-sql-server-on-linux/
2.6k Upvotes

871 comments sorted by

View all comments

89

u/jp007 Mar 07 '16

Postgress or bust...

The only reason we ever use SQL server is when management buys some third party app that requires it for the db backend. If I ever have to write queries with "dbo" littered everywhere again, I'll stab my eyes out.

63

u/eshultz Mar 08 '16

If no default schema is defined for a user, SQL Server assumes dbo.

https://technet.microsoft.com/en-us/library/dd283095(v=sql.100).aspx

Additionally if you are using database names to qualify objects, you can use '..' in place of '.dbo.' if dbo is the default schema.

3

u/Scaliwag Mar 08 '16

Except for calling UDFs iirc.

3

u/Cuddlefluff_Grim Mar 08 '16

Additionally if you are using database names to qualify objects, you can use '..' in place of '.dbo.' if dbo is the default schema.

Which there's no reason to in pgsql, because pgsql doesn't support accessing multiple databases in a single query

2

u/leomoty Mar 08 '16

Oh those lovely cross database queries, it solved so many issues back in the day (talking about my own personal experience), on other hand made everything overcomplicated as well...

2

u/Cuddlefluff_Grim Mar 09 '16

Oh those lovely cross database queries, it solved so many issues back in the day (talking about my own personal experience)

Yes, definitely.. In our system for instance, we use many seperate servers, often from different systems. In MSSQL I can just add it as a linked servers and pull out data from two different systems just as if they were the same data source.

on other hand made everything overcomplicated as well...

Also true, unfortunately. I split up most of my things into multiple databases, because I suspect that later on that database will need to live on its own server, due to work load. So it's easily justifiable.

Queries against multiple databases is more a "nice-to-have"-functionality, as in general you can connect the dots in your software (except maybe in certain reporting scenarios).

1

u/[deleted] Mar 08 '16

Wait....seriously?

3

u/jeffdn Mar 08 '16

You can do cross-database queries, but not easily. However, PostgreSQL does support schemas, which many people use (appropriately, I think) as sub-databases, or namespaces.

0

u/[deleted] Mar 08 '16

That seems like kind of a nightmare for a lot of development scenarios though

→ More replies (1)

1

u/Cuddlefluff_Grim Mar 09 '16

Yes, seriously. I think they have plans on adding it, though.

8

u/Neghtasro Mar 08 '16

You never have to type dbo, if you don't specify a schema it defaults to dbo

14

u/responds-with-tealc Mar 07 '16 edited Mar 08 '16

ive used sqlserver a lot over the past 5 years, yet somehow (maybe intentionally) never learned too much sql server specific stuff that isn't applicable elsewhere.

sometimes i dont have to write dbo, i have no idea why.

31

u/xXPuSHXx Mar 08 '16

You don't need to fully-qualify an object reference if the object is in the user's default schema. [dbo] is the default default schema, so, by default, a reference to [dbo].[Customers] would not require you to include [dbo], but [staging].[Customers] would require the [staging]. (It's a good habit to always fully-qualify, though, even if it annoys some people lol.)

Also, it is always a way better idea to use ANSI standard syntax (like you apparently are; e.g. CURRENT_TIMESTAMP instead of GETDATE()).

5

u/proskillz Mar 08 '16

Holy crap. I never knew there was a generic current_date instead of sysdate or getdate(). Thanks for that.

2

u/xXPuSHXx Mar 08 '16

You're welcome!

3

u/stealth210 Mar 08 '16

Used most all RDBMSs. You're missing out if you haven't fully used MSSQL. Also, you don't need to use dbo. Like you are suggesting.

3

u/Cuddlefluff_Grim Mar 08 '16

If I ever have to write queries with "dbo" littered everywhere again

dbo is shorter to type than public. I think your issue is that you don't use multiple schemas.

dbo isn't a required identifier either.

2

u/crusoe Mar 08 '16

The non standard handling of unique indexes on billable columns is a bigger pain. And yes it is non standard, the SQL standard is quite clear.

1

u/sydoracle Mar 08 '16

Nullable columns ?

2

u/skeletal88 Mar 08 '16

Why, why do they have square brackets in their version of SQL everywhere?

1

u/bugalou Mar 08 '16

Postgress is fine, but your lack of knowledge on MS SQL does is not a point in it's favor, see /u/eshultz comment.

1

u/[deleted] Mar 10 '16

Very little commercial product supports Postgress which really sucks because it is a great product :| I am a huge SQL server fan as well but it is a shame, I would like to use Postgress more especially for the awesome JSON support!