Home > Archive > MS SQL Server > October 2006 > Cannot Update Identity Column while doing Select statement









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Cannot Update Identity Column while doing Select statement
thomson

2006-10-24, 6:33 pm

Hi All,
i do have stored procedure

in which there select id,name from tablename

id i primary key and Identity seed is there for this column



When i directly query this statement it " select id,name from
tablename" , it shows the results

But when i call the same thing via stored procedure , it says Cannot
update identity colum

exec usp_getvalues , it gives the error

Thanks in Advance

Thomson

John Bell

2006-10-24, 6:33 pm

Hi

You would not expect this error from the query you have given therefore I
suspect that your stored procedure is doing something different. Post the
code for the store stored procedure and related tables see
http://www.aspfaq.com/etiquette.asp?id=5006 on how to post DDL in the news
group.

At a guess there is an insert/update statement and you are either including
the identity column or don't have SET IDENTITY_INSERT ON for the table.

John

"thomson" wrote:

> Hi All,
> i do have stored procedure
>
> in which there select id,name from tablename
>
> id i primary key and Identity seed is there for this column
>
>
>
> When i directly query this statement it " select id,name from
> tablename" , it shows the results
>
> But when i call the same thing via stored procedure , it says Cannot
> update identity colum
>
> exec usp_getvalues , it gives the error
>
> Thanks in Advance
>
> Thomson
>
>

Hilary Cotter

2006-10-24, 6:33 pm

identity columns are not updateable.

--
Hilary Cotter
Director of Text Mining and Database Strategy
RelevantNOISE.Com - Dedicated to mining blogs for business intelligence.

This posting is my own and doesn't necessarily represent RelevantNoise's
positions, strategies or opinions.

Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html

Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com



"thomson" <saintthomson@yahoo.com> wrote in message
news:1159770767.122534.31190@h48g2000cwc.googlegroups.com...
> Hi All,
> i do have stored procedure
>
> in which there select id,name from tablename
>
> id i primary key and Identity seed is there for this column
>
>
>
> When i directly query this statement it " select id,name from
> tablename" , it shows the results
>
> But when i call the same thing via stored procedure , it says Cannot
> update identity colum
>
> exec usp_getvalues , it gives the error
>
> Thanks in Advance
>
> Thomson
>



Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2009 droptable.com