473,748 Members | 3,107 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 3889
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******@archo nwest.com> wrote in message
news:tE******** *******@newsrea d3.news.pas.ear thlink.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.btinte rnet.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******@archo nwest.com> wrote in message
news:tE******** *******@newsrea d3.news.pas.ear thlink.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******@archo nwest.com> wrote in message
news:Ux******** *********@newsr ead1.news.pas.e arthlink.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.btinte rnet.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******@archo nwest.com> wrote in message
news:tE******** *******@newsrea d3.news.pas.ear thlink.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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1688
by: SoYouKnowBrig | last post by:
Hi All, I am using Microsoft.ApplicationBlocks.Cache.CacheManager to persist a System.Data.Dataset object. This Dataset object has a DataTable that is created from an existing DataTable using the Clone() method. Before I add the new DataTable to the DataSet, I change the DataType of a DataColumn from System.String to System.Int64. I then add data to the new table and then add it to the DataSet. Then DataSet is then added to the Cache....
14
3015
by: Elias Farah | last post by:
Hi All, What are people's experience in timing Query Performance? I have tried in vain, but get many unpredictable results, with execution proceeding in the background and problems of timing precision. I am trying to assess my applications performance difference using FK using BYTE instead of LONG type. and not enforcing integrity at the database level. (ie, Form level). This only becomes SIGNIFICANT when the field is used highly in...
2
1220
by: s.subbarayan | last post by:
Dear all, I have one peculiar problem with me for which I need ur inputs how to implement it: I have 2 registers each 8 bit wide. The first register stores: Register Map: ________________________________ Can be zero or 1.
6
21476
by: Dan V. | last post by:
I would like to create a 2D string list (2D ArrayList ???). I would like to pass in a table or query as a parameter and have both columns transform into a 2D ArrayList. When I sort the one 'column' in the ArrayList, the other is automatically sorted and so I can use IndexOf without fear. This is because I will be going through 20,000 some odd records and don't want to use a Lookup type of table/query; I figure an ArrayList.IndexOf method...
6
11298
by: Sam | last post by:
Hi Here is my code : Code: Dim dt As New DataTable dt.Columns.Add.ColumnName = "New" dt.Columns("New").DataType = System.Type.GetType("System.String") dt.Columns.Add.ColumnName = "Id" dt.Columns("Id").DataType = System.Type.GetType("System.Integer")
1
5372
by: Modica82 | last post by:
I have created a contract first web service, and to test i have created a client (asp.net) to attempt to test that my web service is at least communication. But when i call a method i get the above error for one of my methods, its not even the one i am calling. Does anyone have an ideas on how to fix this? Regards, Rob
7
2148
by: dotnetnoob | last post by:
i keep getting Object references not set to an instance of an object from this code: Private Sub EqBinding() Dim x As Integer x = 0 Do If CStr(arlsType.Item(x)) = "Bacnet Point" Then Dim str1, str2 As String str1 = CStr(arlsFilePath.Item(x))
0
1219
by: graju80 | last post by:
I am kind of new to Db2... Question: What are the rules that DB2 uses to determine the right datatype for a particular column for on-the-fly SQL generation? For example...
15
3175
by: =?Utf-8?B?UGhpbCBKb2huc29u?= | last post by:
Hi, This is being called in a C# loop within an ado.net transaction from C# 1.1 code. It is used to write large file data to a SQL Server database in chunks, rather than in one go. I had the stored procedure below, which worked until the image datatype was changed to varbinary(max). Now I get the following error:
0
8987
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8826
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
9316
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9241
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8239
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6793
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4597
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4867
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2777
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.