PDA

View Full Version : different version of versions(dialects)



clarksonneo
09-22-2011, 04:36 AM
Hi,

I know that there are more than 1 version(dialect) of SQL.
For example: T-SQL, SQL-92

I want to learn one of the version.
I guess that different database require different version of SQL.

Could you please tell me which version of SQL do the following database require?
Access
Microsoft SQL server
MySQL

Thanks

tcoombes
09-23-2011, 12:02 AM
Access and SQL Server work fine with T-SQL

From Access you need to create a connection to the server then execute the SQL statement from a string variable

Suppose you want to insert something into an SQL Server Table called Fred


Create Connection

Dim db As ADODB.Connection
Dim Mysql as string
Dim MyInt as Integer
Dim MyText as Sting

Myint= 1
MyText = "Something"


Set db = CurrentProject.Connection (This assumes you are assuming using an access ADP or you will have to set up a connection if using an MDB)

If you are using an MDB you will have to do DB.Open and put in the connection string to open a connection to the server. see at the bottom.

Mysql = "Insert Into FRED (Integerfield1,TextField2) values (" & MyInt & ",'" & Mytext & "')"

db.Execute Mysql

This will execute the statement and put the values in SQL Server in table Fred

If you need to connect to the server from an MDB you have to specify the connection string and open it first

With db

.ConnectionString = "Provider=SQLOLEDB; " & _

"Data Source=" & ServerName & "; " & _

"Initial Catalog=NAMEOFDATABASE;" & _

"User ID=sa; Password=; Trusted_Connection=yes"

.Open

End With

Then you can execute DB commands

clarksonneo
09-23-2011, 01:20 AM
Access and SQL Server work fine with T-SQL

From Access you need to create a connection to the server then execute the SQL statement from a string variable

Suppose you want to insert something into an SQL Server Table called Fred


Create Connection

Dim db As ADODB.Connection
Dim Mysql as string
Dim MyInt as Integer
Dim MyText as Sting

Myint= 1
MyText = "Something"


Set db = CurrentProject.Connection (This assumes you are assuming using an access ADP or you will have to set up a connection if using an MDB)

If you are using an MDB you will have to do DB.Open and put in the connection string to open a connection to the server. see at the bottom.

Mysql = "Insert Into FRED (Integerfield1,TextField2) values (" & MyInt & ",'" & Mytext & "')"

db.Execute Mysql

This will execute the statement and put the values in SQL Server in table Fred

If you need to connect to the server from an MDB you have to specify the connection string and open it first

With db

.ConnectionString = "Provider=SQLOLEDB; " & _

"Data Source=" & ServerName & "; " & _

"Initial Catalog=NAMEOFDATABASE;" & _

"User ID=sa; Password=; Trusted_Connection=yes"

.Open

End With

Then you can execute DB commands

Thank you for your reply.

If I want to learn to use MySQL, which version of SQL should I use?
T-SQL or SQL-92?

Thanks

tcoombes
09-23-2011, 10:59 PM
Well T-SQL is definitely OK for SQL Server but I do not think it is right for MYSQL as there is a difference in how you create statements

Norie
09-24-2011, 07:22 AM
T-SQL isn't really a version of SQL.

It's an extension to SQL that's used by Microsoft and a few others.

You shouldn't concentrate on learning a particular version of SQL.

If you just learn 'standard' SQL you will be able to use that anywhere.

When you are using a particular database or server you can learn the specifics for it.