473,386 Members | 1,779 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Changing a column datatype

Hi,

I had to change a columns datatype from money to varchar(100)...I have data in my table..I am using sql-server 2005..I tried the following coding..

ALTER TABLE bb
ALTER COLUMN dealercost varchar(100) NOT NULL

It gives me an error as:

Msg 260, Level 16, State 1, Line 1
Disallowed implicit conversion from data type money to data type varchar, table 'ACIG01_DSV.dbo.bb', column 'DealerCost'. Use the CONVERT function to run this query.


Plz Help..

Thanks in advance
Jan 29 '08 #1
3 2351
deepuv04
227 Expert 100+
Hi,

I had to change a columns datatype from money to varchar(100)...I have data in my table..I am using sql-server 2005..I tried the following coding..

ALTER TABLE bb
ALTER COLUMN dealercost varchar(100) NOT NULL

It gives me an error as:

Msg 260, Level 16, State 1, Line 1
Disallowed implicit conversion from data type money to data type varchar, table 'ACIG01_DSV.dbo.bb', column 'DealerCost'. Use the CONVERT function to run this query.


Plz Help..

Thanks in advance

try without not null in your query


ALTER TABLE bb
ALTER COLUMN dealercost varchar(100)


thanks
Jan 29 '08 #2
try without not null in your query


ALTER TABLE bb
ALTER COLUMN dealercost varchar(100)


thanks
Tried without using not null in my query

and still got the same error
Jan 29 '08 #3
debasisdas
8,127 Expert 4TB
Try to use alter the table .
Please find the syntax here .
Jan 29 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

13
by: Peter | last post by:
Can anyone tell me how to change the data type of a field in a table created with a make table query? The field is a binary and must be changed to text. alternately does anyone know how to specify...
4
by: Brian Brane | last post by:
I have properties that wrap DataRow columns as in: public int aNumber { get{ return m_DataRow; } set{ m_DataRow = value; } } If the column happens to contain DBNull, I get a cast exception...
1
by: Geoff Jones | last post by:
Hi Is it possible to change the type of data a column holds in DataTable at runtime? For example, suppose that the table column originally holds Strings, can we, at runtime, change it to...
2
by: Griff | last post by:
When attempting to change the datatype for a datatable column with the following code: dtap.Columns(4).DataType = system.Type.GetType"System.String") I keep getting an error that says that I...
7
by: Simon Verona | last post by:
I posted this in dotnet.languages.vb.controls but thought I'd post here as well.. I have a combobox that is bound to a dataview generated from a dataset. The dataset has a single table...
1
by: Prabu Subroto | last post by:
Dear my friends... I want to change the datatype of a completed table (has had already content). But I don't know how. Here is my try: " kv=# alter table customer alter column address set...
5
by: Ken | last post by:
I'm trying to run a loop to capture column property information from a table in my datasource. Can anybody see where this is going wrong? Dim tbl As New DataTable Dim col As DataColumn Dim x...
2
by: Rahul B | last post by:
I am new at DB2 . so please guide I am trying to change the Datatype of a column in the table. CREATE TABLE testschema.player ( NAME VARCHAR(120) NOT NULL, country ...
1
by: pulavarthipraveen | last post by:
When I tried to change the datatype of the column through "Alter table tablename Alter column columnname Newdatatype" query it's is throw the error below: "The index 'IndexName' is dependent on...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.