Groups | Blog | Home
all groups > sql server reporting services > november 2005 >

sql server reporting services : Report Model Project: Imported Data Types


Greg T. Smith
11/7/2005 8:41:31 AM
When importing some tables into a data source view I am unable to create
relationships due to DataType incompatibility.

The table in question gets imported with a System.Int32 DataType for the
primary key, but should be System.Byte. The foreign key gets imported
correctly as System.Byte. I have checked the SQL Server and verified the use
of tinyint for both the primary and foreign keys.

There is a workaround, but it would be nice if there were a better way. :)

Workaround: (This seems to make the DataType show up correctly.)

1. Right-click on the table in the data source view
2. Expand the "Replace Table" menu
3. Select "With New Named Query..."
4. Click OK

In the hopes of a better clue to the solution I have included the script for
one set of the tables I am having trouble with below.
---------------------------------------------------
CREATE TABLE [dbo].[COUNTRY]
(
[country_id] [tinyint] IDENTITY(1,1) NOT NULL,
[country] [varchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
CONSTRAINT [PK_COUNTRY] PRIMARY KEY CLUSTERED
([country_id] ASC) WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
CREATE TABLE [dbo].[STATE]
(
[state_id] [tinyint] IDENTITY(1,1) NOT NULL,
[state] [varchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[country_id] [tinyint] NOT NULL,
CONSTRAINT [PK_STATE] PRIMARY KEY NONCLUSTERED
([state_id] ASC) WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY],
CONSTRAINT [IX_STATE] UNIQUE CLUSTERED
([state] ASC, [country_id] ASC) WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[STATE] WITH CHECK ADD CONSTRAINT [FK_STATE_COUNTRY]
FOREIGN KEY([country_id]) REFERENCES [dbo].[COUNTRY] ([country_id])
Greg T. Smith
11/7/2005 9:32:02 AM
Note: When I modified the table so that the state_id field was no longer an
Identity field, the import showed System.Byte. This is not a good option for
AddThis Social Bookmark Button