tsql vs sql

tsql vs regular sql syntax


i am going though above syntax

is oracle ms sql db2 etc syntax same or differnt?
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Vitor MontalvãoMSSQL Senior EngineerCommented:
ANSI-SQL is the standard SQL language, which means that if you use only ANSI-SQL it will only work in any RDBMS (MSSQL, ORACLE, DB2, ...).
But any of those RDBMS has their own SQL language, and for MSSQL it's T-SQL. Mostly it has some extra functions that doesn't exist in others RDBMS or if exists it may work somehow differently.
sql is "mostly" the same between the platforms.

The procedural languages of each vary quite a bit though  (t-sql for mssql,  pl/sql for oralce,  sql-pl for db2)
Mark WillsTopic AdvisorCommented:
SQL Code written for one platform specific language probably wont work on another.

For example, in T-SQL we use LEN(), but Oracle uses LENGTH(), and MySQL uses LENGTH() for bytes or CHAR_LENGTH() for number of characters.

They are all based on the Standards controlled by ANSI and ISO which *should* imply a consistency to make it portable. However it isnt transparent across platforms. There are nuances from each manufacturer.

So, while they have their own nuances, they will be familiar enough (because of the Standards) to work out what is going on.

But, you probably cant copy code from one platform to another without expecting to fine tune a little.
gudii9Author Commented:
sql is "mostly" the same between the platforms.

The procedural languages of each vary quite a bit though  (t-sql for mssql,  pl/sql for oralce,  sql-pl for db2)

how SQL and procedural languages are different?
i thought all are same?
Mark WillsTopic AdvisorCommented:
SQL is the generic term.  SQL is a set-based, declarative programming language. Each manufacturer adds extensions / their own interpretation to form their versions of what is more commonly called procedural language. It is the code used to drive the relational DB Server.

From  wikipedia we see :
Source			Common name	Full name
ANSI/ISO Standard		SQL/PSM		SQL/Persistent Stored Modules
Interbase / Firebird	PSQL		Procedural SQL
IBM DB2			SQL PL		SQL Procedural Language (implements SQL/PSM)
IBM Informix		SPL		Stored Procedural Language
IBM Netezza		NZPLSQL[20]	(based on Postgres PL/pgSQL)
Microsoft / Sybase		T-SQL		Transact-SQL
Mimer SQL			SQL/PSM		SQL/Persistent Stored Module (implements SQL/PSM)
MySQL			SQL/PSM		SQL/Persistent Stored Module (implements SQL/PSM)
MonetDB			SQL/PSM		SQL/Persistent Stored Module (implements SQL/PSM)
NuoDB			SSP		Starkey Stored Procedures
Oracle			PL/SQL		Procedural Language/SQL (based on Ada)
PostgreSQL			PL/pgSQL	Procedural Language/PostgreSQL Structured Query Language (implements SQL/PSM)
Sybase			Watcom-SQL	SQL Anywhere Watcom-SQL Dialect
Teradata			SPL		Stored Procedural Language

Open in new window


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Query Syntax

From novice to tech pro — start learning today.