simple question for damn SQL-Server

Posted on 2003-03-06
Medium Priority
Last Modified: 2008-03-17

I already discovered that SQL statements like "alter table messages modify email char(35);" have to be changed to "alter table messages alter column email char(35);" for Transact-SQL to understand them :/

And also that parentheses are not welcome in such a statement : "alter table status add (MsgToDo smallint default 1,StatsToDo smallint default 1,CleanToDo smallint default 1);"

I also discovered I had to type "go" ("go, go, Goldorak go" :D ) a zillion times to make MS-SQL Server to process my statements 8-)) How marvelous 8-))

My question is now "how to make a UNIQUE field auto-incrementable" ? as this doesnt work in Transact-SSL (thank you Billou) :

create table activite (id integer unique auto_increment,ip char(15));
Question by:VGR
LVL 43

Accepted Solution

TimCottee earned 80 total points
ID: 8078721
Create table activite
(id integer identity(1,1),
ip char(15))

The autoincrement datatype in access is known as an identity datatype in SQL. The first parameter is the start or seed and the second is the number to increment by each time.(100,11) will give 100,111,122,133 etc for example.
LVL 15

Author Comment

ID: 8078793
Right. Missed this in :
< column_definition > ::= { column_name data_type }
    [ COLLATE < collation_name > ]
    [ [ DEFAULT constant_expression ]
        | [ IDENTITY [ ( seed , increment )

good then 8-)

PS : the above statements come from MySql, not Access :D

Is this common in MS-Sql Server that "normal" SQL has to be modified ? Again Macro$uft changing the rules, like for the Java API ?

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Recently we ran in to an issue while running some SQL jobs where we were trying to process the cubes.  We got an error saying failure stating 'NT SERVICE\SQLSERVERAGENT does not have access to Analysis Services. So this is a way to automate that wit…
One of the most important things in an application is the query performance. This article intends to give you good tips to improve the performance of your queries.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…
Suggested Courses

621 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question