468,253 Members | 1,296 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,253 developers. It's quick & easy.

Can't change datatype???

Hello all,

First of all, I must state that I'm new to SQL Server, but have been a
long-time software guy for quite some time. Please excuse the potential
simplicity of the solution to my problem.

I create a blank database (TestDB) under my server machine (SQL Server 2000
Standard)... I then create a new table (Run_Number) with only one record in
it.

Field(1): Next_Run_Number (bigint), identity w/ seed 1 and increment 1, no
nulls, PK

I can successfully save this new table to disk and everything seems fine...
problem comes up when I go back into the table and change the datatype from
(bigint) to (int). I try and save changes and I get the following error
prompt:

'Run_Number' table
- Unable to create index 'PK_Run_Number'.
ODBC error: [Microsoft][ODBC SQL Server Driver]Invalid cursor state

I've checked and there's plenty of disk space available and the dbase is set
to grow by 10% as necessary. Any ideas what could be going wrong? I'm able
to successfully make this change on my other machine running SQL Server 2000
Personal. Thoughts?

TIA!

-J.C..


Jul 20 '05 #1
4 3565
Hi

I don't really know why you are getting this error. Are you doing the change
directly in Enterprise Manager?
Have you tried removing the PK and setting seed to No before changing the
Datatype from bigint to int and then applied the PK and the seed again after
the change?

Be careful if you change the datatype from bigint to int as bigint values
outside the int value range obviously won't be converted correctly.

HTH, M

"J.C. Flores" <jc******@archonwest.com> wrote in message
news:tE***************@newsread3.news.pas.earthlin k.net...
Hello all,

First of all, I must state that I'm new to SQL Server, but have been a
long-time software guy for quite some time. Please excuse the potential
simplicity of the solution to my problem.

I create a blank database (TestDB) under my server machine (SQL Server
2000 Standard)... I then create a new table (Run_Number) with only one
record in it.

Field(1): Next_Run_Number (bigint), identity w/ seed 1 and increment 1, no
nulls, PK

I can successfully save this new table to disk and everything seems
fine... problem comes up when I go back into the table and change the
datatype from (bigint) to (int). I try and save changes and I get the
following error prompt:

'Run_Number' table
- Unable to create index 'PK_Run_Number'.
ODBC error: [Microsoft][ODBC SQL Server Driver]Invalid cursor state

I've checked and there's plenty of disk space available and the dbase is
set to grow by 10% as necessary. Any ideas what could be going wrong?
I'm able to successfully make this change on my other machine running SQL
Server 2000 Personal. Thoughts?

TIA!

-J.C..

Jul 20 '05 #2
Yes, I'm doing this change in EM. I tried some variations re: removing PK,
disabling seed, etc... but the main point I want to convey is that I don't
have to do this type of disabling in my Personal edition of SQL Server... in
Personal edition, all I do is change bigint to int datatype and i'm able to
save without a hitch. Yet, the Standard edition is giving me problems...
same tables. And just for clarification, the table has only ONE FIELD... no
records (completely empty table).

Are we perhaps seeing issues related to permissions on the Standard edition
server? Maybe I can create tables, but for some reason can't change them
once they're created?

Ideas? I would greatly appreciate any help offered.

-J.C..

"Martin Feuersteiner" <th************@hotmail.com> wrote in message
news:ci**********@titan.btinternet.com...
Hi

I don't really know why you are getting this error. Are you doing the
change directly in Enterprise Manager?
Have you tried removing the PK and setting seed to No before changing the
Datatype from bigint to int and then applied the PK and the seed again
after the change?

Be careful if you change the datatype from bigint to int as bigint values
outside the int value range obviously won't be converted correctly.

HTH, M

"J.C. Flores" <jc******@archonwest.com> wrote in message
news:tE***************@newsread3.news.pas.earthlin k.net...
Hello all,

First of all, I must state that I'm new to SQL Server, but have been a
long-time software guy for quite some time. Please excuse the potential
simplicity of the solution to my problem.

I create a blank database (TestDB) under my server machine (SQL Server
2000 Standard)... I then create a new table (Run_Number) with only one
record in it.

Field(1): Next_Run_Number (bigint), identity w/ seed 1 and increment 1,
no nulls, PK

I can successfully save this new table to disk and everything seems
fine... problem comes up when I go back into the table and change the
datatype from (bigint) to (int). I try and save changes and I get the
following error prompt:

'Run_Number' table
- Unable to create index 'PK_Run_Number'.
ODBC error: [Microsoft][ODBC SQL Server Driver]Invalid cursor state

I've checked and there's plenty of disk space available and the dbase is
set to grow by 10% as necessary. Any ideas what could be going wrong?
I'm able to successfully make this change on my other machine running SQL
Server 2000 Personal. Thoughts?

TIA!

-J.C..


Jul 20 '05 #3
One thing you might try is to click the 'save change script' button in the
EM table designer and then try to run that script using Query Analyzer.
Perhaps this will help isolate the problem.

--
Hope this helps.

Dan Guzman
SQL Server MVP

"J.C. Flores" <jc******@archonwest.com> wrote in message
news:Ux*****************@newsread1.news.pas.earthl ink.net...
Yes, I'm doing this change in EM. I tried some variations re: removing
PK, disabling seed, etc... but the main point I want to convey is that I
don't have to do this type of disabling in my Personal edition of SQL
Server... in Personal edition, all I do is change bigint to int datatype
and i'm able to save without a hitch. Yet, the Standard edition is giving
me problems... same tables. And just for clarification, the table has
only ONE FIELD... no records (completely empty table).

Are we perhaps seeing issues related to permissions on the Standard
edition server? Maybe I can create tables, but for some reason can't
change them once they're created?

Ideas? I would greatly appreciate any help offered.

-J.C..

"Martin Feuersteiner" <th************@hotmail.com> wrote in message
news:ci**********@titan.btinternet.com...
Hi

I don't really know why you are getting this error. Are you doing the
change directly in Enterprise Manager?
Have you tried removing the PK and setting seed to No before changing the
Datatype from bigint to int and then applied the PK and the seed again
after the change?

Be careful if you change the datatype from bigint to int as bigint values
outside the int value range obviously won't be converted correctly.

HTH, M

"J.C. Flores" <jc******@archonwest.com> wrote in message
news:tE***************@newsread3.news.pas.earthlin k.net...
Hello all,

First of all, I must state that I'm new to SQL Server, but have been a
long-time software guy for quite some time. Please excuse the potential
simplicity of the solution to my problem.

I create a blank database (TestDB) under my server machine (SQL Server
2000 Standard)... I then create a new table (Run_Number) with only one
record in it.

Field(1): Next_Run_Number (bigint), identity w/ seed 1 and increment 1,
no nulls, PK

I can successfully save this new table to disk and everything seems
fine... problem comes up when I go back into the table and change the
datatype from (bigint) to (int). I try and save changes and I get the
following error prompt:

'Run_Number' table
- Unable to create index 'PK_Run_Number'.
ODBC error: [Microsoft][ODBC SQL Server Driver]Invalid cursor state

I've checked and there's plenty of disk space available and the dbase is
set to grow by 10% as necessary. Any ideas what could be going wrong?
I'm able to successfully make this change on my other machine running
SQL Server 2000 Personal. Thoughts?

TIA!

-J.C..



Jul 20 '05 #4
Hey, remove the identity seed, change the datatype, enable the
identity seed back. There is a good chance it might fix it. If not
drop table create all over since you said there are no records.
Hope this helps, Girish
Jul 20 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

14 posts views Thread by Elias Farah | last post: by
2 posts views Thread by s.subbarayan | last post: by
1 post views Thread by Modica82 | last post: by
7 posts views Thread by dotnetnoob | last post: by
15 posts views Thread by =?Utf-8?B?UGhpbCBKb2huc29u?= | last post: by
reply views Thread by NPC403 | last post: by
reply views Thread by kermitthefrogpy | last post: by
reply views Thread by zattat | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.