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
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

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

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Suggested Courses

770 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