Showing posts with label auto. Show all posts
Showing posts with label auto. Show all posts

Wednesday, March 28, 2012

its been a while since Ive used sql....

...and I was using mySql b4, but on ms sql server when you create a table whats the syntax for specifying a field that auto increments for each new record added?

'm trying the following:

1> create table maillist(id autoincrement(), email varchar)
2> go
Msg 170, Level 15, State 1, Server ****, Line 1
Line 1: Incorrect syntax near ')'.
1>IDENTITY is the keyword used in SQL Server


CREATE TABLE [dbo].[Debug] (
[DebugID] [int] IDENTITY (1, 1) NOT NULL ,
[DateEntered] [datetime] NULL ,
[Message] [nvarchar] (4000) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
) ON [PRIMARY]
GO

|||i take it

dbo = the db name

debug = the table

dbugid = my field name

int = type

what is: on [primary]?|||what does the (1,1) signify?|||The seed value and incremental step for the identity column. (e.g starts from 1 and increases 1 at a time 1,2,3,4,5...)|||ahhh

I getcha :)|||dbo is the owner of the table (dbo is best).
Debug is the table.
debugid is the field name.

Primary is the file group (you can normally ignore it, this is script generated by the Enterprise Manager).

Monday, March 12, 2012

Issue with sorting reports

Hi,

I'm having an issue with sorting reports. I have an order by in the query which returns the results how I want them, but if I use the auto generated columns and layout they are not in the order that the query returns them. However, if I manually create a new table and put the results in that they are ordered fine.

I am having this problem in reporting services for sql 2000, but my workmate has had exactly the same thing in his reporting for 2005.

Any help would be greatly appreciated.

Rob

What is the auto generated columns and layout?|||

How can you auto generate columns in sql reporting table? Are you using Visibility expression for the columns in the table to make it look dynamic? Can you provide the query and the report layout you have along with the explanation of the problem?

Shyam