Changing The Size Of A Varchar Field

Jul 7, 2006

We have a small table of about 13 million rows that needs altered. A column in the table needs to be changed from a varchar(20) to a varchar(500). When we ran the alter table script, 3 hrs later and it wasn't done running. Any suggestions on what we can do to speed up the process?


Thanks ahead of time
DMW


Edit:
We are running SQL Server 2000 and the db at the time was running in simple mood

View 1 Replies


ADVERTISEMENT

SQL 2012 :: Varchar - Changing Text Column Size

Aug 7, 2015

Impact on performance of changing Text column size.

However, many of them were regarding older releases of SQL Server.

Does the architecture in 2012, 2014 releases make this less of an issue ?

In other words, why bother going from Varchar(1000) to Varchar(50) ?

I'm just thinking maybe there is column compression automatically now.

View 4 Replies View Related

Dynamically Changing The Length Of A Varchar(n) Field

Dec 26, 2006

Hi Everyone,I have a question about dynamically changing the length of a varchar(n)field, in case the value I'm trying to insert is too big and will givea "truncated" error, but before the error is given! i.e. Is there somekind of a way to "test" the length of the field while Inserting thevalue into it, and to have it automatically increase its length to thelength of the value being inserted, in case the value is too big?I've been able to do this in a "primitive" way, simply by identifyingthe specific error number in case the value is being truncated, andthen increasing the length of the varchar(n) field by using the ALTERcommand, and then duplicating the insert statement, but is there astandard (shorter) way of doing this?Here is my code (I'm working in an ASP environment):<%var_txt = "abcdefghijklmnopqrstuvwxyz12345678789"sql = "Insert Into Table1 (text) Values ('" & var_txt & "')"On Error Resume Nextconn.Execute sqlIf err = -2147217833 ThenResponse.Write "Error Recognized Successfully!<br /><br />"sql = "ALTER TABLE Table1 ALTER COLUMN text VARCHAR(" &Len(var_txt) &") NOT NULL"On Error Resume Nextconn.Execute sqlIf err<>0 ThenResponse.Write "Error while trying to alter Column:<br/>" & err & "= " & err.description & "<br />"ElseResponse.Write "Column altered successfully to: " &Len(var_txt) &"<br />"sql = "Insert Into Table1 (text) Values ('" & var_txt &"')"On Error Resume Nextconn.Execute sqlIf err<>0 ThenResponse.Write "<br />Error number 2:<br />" &err.description &"<br />"ElseResponse.Write "Now it was added successfully!HaHa!<br />"End IfEnd IfElseResponse.Write "Success."End If%>Thanks in advance!

View 2 Replies View Related

Size To Specify For Varchar(Max) Field

Mar 23, 2008

After reading Dan Guzman's blog entry (http://weblogs.sqlteam.com/dang/archive/2008/02/21/Dont-Bloat-Proc-Cache-with-Parameters.aspx) I started modifying some of my code to try it out and ran into a stumbling block. What size would you specific for a varchar(MAX) field?
Since a varchar max field can hold up to 2 billion chracters I really don't think I need to specify 2 billion as the size. Anyone have any ideas?
 

View 2 Replies View Related

Question Regarding Size Of Varchar Field

May 26, 2005

Hi,I am using MSDE together with Enterprise Manager.I have a table with a field named description.This field will be filled by a web forms's textbox web control.The textbox's maxsize attribute is set to "3000" characters.What size do I have to adjust for my DB field description?Is the size of 3000 in Enterpise Manager equal to 3000 characters for the textbox?I am just trying to avoid errors if MSDE cuts off the string that comes from the textbox webcontrol.

View 4 Replies View Related

Integration Services :: Error While Changing Field Size

Sep 10, 2015

I am loading from SQL Server 2008 to Access 2010 using SSIS. One of the columns in the table I am loading into is a Number datatype and Fieldsize is long integer. The values are being truncated, so I want to change the Fieldsize to DOUBLE.  However, when I do that I receive the error below. What should I do? I would like not to change my Windows registry.

This error can be caused by one of the following:

The maximum number of columns allowed in a table or the maximum number of locks for a single file is exceeded.

The indexed property of a field is changed from Yes (Duplicates OK) to Yes (No Duplicates) when duplicate data exists in the table.

An expression is not specified in the Expression property of a calculated field. 

If the maximum number of locks per file was exceeded, you can increase the number by editing a registry entry. However, this is not a recommended option.

If you use Registry Editor incorrectly, you could cause serious problems that require you to reinstall the operating system. Microsoft cannot guarantee that you can solve problems that result from using Registry Editor incorrectly. Use Registry Editor at your own risk.

Make a backup of the registry. Find the MaxLocksPerFile registry value by using the Windows Registry Editor, and then increase the value. The MaxLocksPerFile value is saved as part of the following key:

HKEY_LOCAL_MACHINESOFTWAREMicrosoftOffice14.0Access Connectivity EngineEnginesACE

If the Indexed property of a field and duplicate data is located in the table, reset the Indexed property to the previous setting, or remove duplicate records from the table.

While I was loading to the same table a few days ago, I received a warning and the task took approx 9 hours. I am attaching the screen shot.

View 8 Replies View Related

Importing Of Varchar Field Data In Number Field

Dec 5, 2007

i want to import/copy a varchar field numeric data in to number field pls suggest the solution
one thing more can i convert field type of a table how?


jto it

View 5 Replies View Related

Convert Field From VarChar To Int With Speical Characters In Field

Aug 29, 2007

Hello,

I have a table with a column that is currently a varchar(50), but I want to convert it into an int. When I try to just change the type in design mode I get an error that conversion cannot proceed. When I look at the field it appears some of the entries have special characters appended at the end, I see a box after the value.

How can I remove all speical characters and then convert that field to an int?

Also I tried the following query which did not work as well, same error about conversion.

UPDATE myTable SET field = CAST(field AS int)

View 2 Replies View Related

T-SQL (SS2K8) :: Changing Varchar To Datetime?

Oct 2, 2014

I can't get a varchar to datetime conversion to work. The varchar data is in the form yyyymmddhhmi

I tried convert(datetime, '200508310926')

also tried cast('200508310926' as datetime) both have error "Conversion failed when converting date and/or time from character string"

Is there a format code that needs to be there? If so, I can't figure out what it should be.

I eventually need to convert these to dates and compare them to getdate, example:

...where convert(datetime, dtfield) >= getdate()-1

View 7 Replies View Related

Changing All VARCHAR To NVARCHAR Database-wide?

Jan 15, 2005

Hi,
I have an ASP.NET application that uses VARCHAR extensively in the tables and, more importantly, stored procedures (a couple hundred of them).

This app needs to start accepting foreign language in some areas, so I was wondering if there was some way to go through the tables and, more importantly, the stored procedures and change all "VARCHAR" references to "NVARCHAR" ?

Are the stored procedures stored as a text file somewhere on the server? If so I could use some sort of "replace" software utility to go through and change all VARCHAR to NVARCHAR

thanks!

-Bret

View 2 Replies View Related

Changing Date Format And Casting As Varchar?

Jul 21, 2014

My current Query takes the DATE value stored in P.CreatedDate and makes it VARCHAR, then stores it in the table. I need to format this to return YYYYMMDD. How would I go about this?

Current Code:

Code:
CAST(P.CreatedDate AS VARCHAR) AS DateEntered,

View 3 Replies View Related

Database Growth Excessive When Changing Varchar Length From 50 To 100.

Aug 9, 2007



Hi all,

I'm trying to get an understanding of a serious problem I have with a large DB in production. This is going to be obvious to someone (everyone probably) <bg>

I have a table which consists of numerous varchars and ints but also a Text type field. This table resides in a SQL 2000 Database. This DB currently has a data file size of 16Gb and a Transaction Log size of 17Gb. When I edit the table and increase the size of a Varchar field from 50 to 100 these files grow to more than double their size!

Why is this happening and how can I prevent this?

TIA

NozFx

View 1 Replies View Related

Sql Standard Varchar Size

Feb 20, 2004

i know ms sql allows varchar to reach a size of 8000. i've also read that oracle allows for 4000, though i've never used it and not sure about that. so my question is what is the sql standard for a varchar size?

View 6 Replies View Related

How Can I Increase The Size Of Varchar

Nov 10, 2006

Dearfriends,
please guide me,
i've a column with varchar(100).
presently, i need that column as varchar(500).



thank you very much.

Vinod

View 4 Replies View Related

Changing Log File Size

Dec 14, 2001

Greetings,

I want to increase the size of a transaction log file. Can I do this while the database is live? If not, what do I need to do?

Thanks!

Rob

View 2 Replies View Related

Changing The Size Of Tempdb

Jan 17, 2001

We currently have a hard-drive size of 3.89MB and 3.3MB is being used by tempdb. I have tried shrinking the database truncateonly but this is not working. The problem is that the tempdb file is as large as my C: drive size. In addition can this be moved to another directory. For example can I move the tempdb.mdf and ldf from C: to E:. Any help would be greatly appreciated.

Thanks

View 1 Replies View Related

Changing Value Of Initial Size (MB)

Dec 5, 2007

I would like to increase the initial size of a SQL 2005 DB from 150 to 250 GB to prevent automatic autogrowth; would this have any impact in production if you do it on the fly?

Thanks,

Carlos

View 3 Replies View Related

Changing The Log Initial Size

Jan 27, 2007

Folks:

Is there a way to decrease the initial size of a database/log file? I've noticed you can increase it, but if you decrease it, after you confirm the change and go checking again, you will see nothing happened.

Is there a way? Am I missing anything?!

View 4 Replies View Related

Changing Value Of Initial Size (MB)

Dec 5, 2007



I would like to increase the initial size of a SQL 2005 DB from 150 to 250 GB to prevent automatic autogrowth; would this have any impact in production if you do it on the fly?


Thanks,


Carlos

View 1 Replies View Related

Changing The Command Buffer Size?

Feb 11, 2004

Is it possible to change the command buffer size??

I need to export data on demand to an excel spreadsheet via a stored procedure. The only way I know how to do this is through a bulk copy command; but my query is much to big for the buffer....

Thanks!!!

View 9 Replies View Related

Changing Table Column Size

Mar 2, 2004

I'm new to mssql.

I need to change the size of a column of a table from char(255) to char(500). I used the line:

alter table table_name alter column column_name char(500)

When I run that command, I get a message that it was sucessful. However, when I try to enter data into the changed column, the number of characters I can enter is still 255. I check the information schema for the column and the 'character_maximum_length' field is 500.

What is the problem here? Is the maximum allowable length for char 255? How can I get a column to have 500 characters?

View 6 Replies View Related

Changing Footer Size On Last Page Only

Apr 29, 2008



Dear all,

I am having a problem with the footer in my SQL Reporting Services project. I am trying to print a disclaimer in a text box on the last page in the footer. I can get the text box in the footer just fine but as the disclaimer is quite a lengthly multi line text string the footer has to be enlarged in order to fit the whole text box in.

This causes a problem on all the other pages where even though the footer is not displayed on pages before the last page it still takes up space stopping other data from being displayed where the footer would normally be.

Is there a way for me to set the footer size to a default value all all pages except the last page? I just want to enlarge the footer to about 1.5" on the last page to print my disclaimer without effecting the other pages layout.

Many thanks in advance,

Trevor Keast

View 14 Replies View Related

Buffer Size Of Varchar In SQL Server 2000

Apr 11, 2008



Hi all

I am Importing data from CSV to Table using DTS package it showing error "exceeded Buffer size",
What is Buffer size of varchar in SQL Server2000


Appreciated your help

View 5 Replies View Related

Changing Column Size In Existing Databese?

Jul 20, 2005

I must increase column (filed) size in existing datebase but without usingEnterprise manager....(Becouse we use MSDE on our clients PCs)The Filed is part of primary and foreign key constraints....And every constraint has diferent index number in each database...for example (PK_something_9e382hjl8), and I don't know how to pick thisvalue before "drop constraint" command.....Thank you very much....

View 1 Replies View Related

Help! Limitations On Varchar Size And Not Being Able To Use TEXT In Stored Procedure

Nov 4, 1999

I am stuck! and need help!

I have a problem I can't seem to find the solution with this aweful limitations on VARCHAR fields of 255.

Within a stored procedure called Store_Check, I need to dynamically build a string (@string) using VARCHAR(255) since the text datatype can't be used in a stored procedure.

So,this string is built according to whether the Store ID is NOT NULL. So if the StoreID is not null, I start building this string 'Exec Update_Store_Address @StoreID1, @address2'. There are 20 StoreID's passed into Store_Check. IF all 20 StoreID's are not NULL, the executed String greatly exceeds 255 because the string winds up looking like this

'Exec Update_Store_Address @StoreID1, @address1 Exec Update_Store_Address @StoreID2, @address2 Exec Update_Store_Address @StoreID3, @address3 Exec Update_Store_Address @StoreID4, @address4 Exec Update_Store_Address @StoreID5, @address5 Exec Update_Store_Address @StoreID6, @address6 etc. etc.'

I am not executing this string within the StoredCheck procedure. It needs to be passed as ONE string to a VB program and it gets executed by the VB program. Even if I create 4 local variables and concatenate them, it stops at the 255th character.

Also, a local varialbe of type TEXT cannot be declared within stored procedure.

What can I do? I am stuck!
Angel

View 1 Replies View Related

Changing Value Of A Field

Jun 5, 2006

Bob writes "I want to change the value of a field but it is part of a
unique index. Can someone help me do this.
I need to update about 55000 rows.

thank you very much."

View 2 Replies View Related

Changing A Field Value In SRS

Jan 27, 2008

Hello,

I have a field on my SRS Report called directioncode.
This field gives me a value of 1 or 0.

How do I fix this code so
if the value of directioncode is 0, the text "Incoming" is displayed
if the value of directioncode is 1, the text "Outgoing" is displayed?

Current value in the expression area of my field....
=Fields!directioncode.Value

View 5 Replies View Related

Sum Of A Field That Has A Type Varchar

Mar 28, 2007

Hi guys
        I need immediate help with a query that I am trying to write. I want to sum the values in a query but the field has a type of varchar and it has decimal numbers too. So if I do the query something like that, that converts the field to int, I get the error message.
I tried converting it into real or float but I get error message on that too. I need help with adding the calculatedValues and getting there sum. I would appreciate any help with that.
 
Thanks
-Sarah
Select SUM(Convert(int, calculatedValue))
from monitor.dbo.monHistory
where LocalTimeWithoutDst > '8/26/06' and LocalTimeWithoutDst < '8/28/06'
 
This is the error message I recieve:
Conversion failed when converting the varchar value '274.2' to data type int.
 

View 6 Replies View Related

Searching In A Varchar Field

Jul 12, 2001

I have a varchar column which containd comma delimited values like
Rec# Fruits
1 Apple, Peach, Strawberry
2 Orange, Mango
3 Banana, Grape
...........

Now i have to add search facility so that a user could search for more than 1 fruit at a time. I have a Stored Procedure which returns records from this table. that SP has a Parameter @SearchFruit Varchar(500) and the user could pass in values like 'Apple, Mango' to this parameter.

Now how should i write the SQL so that i get back the records Rec# 1 & 2 since apple is there in 1st record and mango is there in the 2nd ??

I know if a put the comma delimited values as individual records in a temporary table and also do the same for the parameter values then i can get the desired results. But i want to avoid doing that. Any other way ?


Thanks
Sumit.

View 4 Replies View Related

VARCHAR Max Field Length

Nov 21, 2000

What is the max field length in SQL Server 7.0 that a varchar field can be?
I think 8000. Please advise
Thanks

View 2 Replies View Related

Update A Varchar Field

Oct 4, 2004

I would like to append information to a varchar field with an update statement, for example the field currently contains a name (Mark) and I would like to add information to name for business purposes, to update it to Markqw215, is this possible to do with an update statement?
Thank you.

View 4 Replies View Related

Update A Varchar Field

Oct 4, 2004

I would like to append information to a varchar field with an update statement, for example the field currently contains a name (Mark) and I would like to add information to name for business purposes, to update it to Markqw215, is this possible to do with an update statement?
Thank you.

View 1 Replies View Related

Calculation On A Varchar Field

Jan 17, 2005

I'm importing data from a text file into SQL as a varchar, and I'm leaving it a varchar in its final destination table. It is essentially a price, i.e., $25.65. I'm using this price field (varchar) to perform a calculation...

Everything seems to work OK, but I'm not sure about using this varchar field to perform this calculation. Is this doable, or should it absolutely be converted to say, decimal?

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved