I know we could change the data type or width of a table column in SQl 7 database, but I am not certain if this column is a primary key. Can we change a primary key column width? If we can, how about this column as a foreign key in another table? Will it be automatically updated to the same width? Thanks in advance for your input.
I'm trying to read in a flat file (which, admittedly, has one very wide column), and it keeps breaking because of truncation when it tries to read in the file.
I am facing issue with the auto fit width. When i am creating a report which includes table. The table column length should get adjusted to the text size displayed in it instead of displaying the text in 2 lines. But i dont find any way to set that option. Could anyone let me know how to set the column length as per the text displayed in the column in table.
Hi All, Is there a way by which we can modify the width of a column of a table which is being replicated without touching the ongoing transactional replication? This is for MSSQL2000 Transactional Replication.
I know (and successfully tried) that we can add a column to a table and that gets propaged to the replicate database and indeed the added column gets reflected there. How to add a column? sp_repaddcolumn or Right Click on the Publication-Properties and it shows a button to Add a Column.
This is what I have tried for modifying the width of a column of a table participating in Transactional Replication from varchar(10) to varchar(100)
MH (source) -> MH1 (Replicate)
The column €ścol1€? had width of varchar(10) and this was altered to varchar(100).
How do i import a Varying Column Width Flat file into a Table using SSIS?
I have a flat file that has 4 columns with varying width Like I should read the file as Col 1 - (1 to 10 Characters) Col 2 - (12 to 21 Characters) Col 3 - (22 to 35 Characters) Col 4 - (36 to 38 Characters) At the end of the record is a "LF"
I think "Fixed Width" Columns allow me to define a standard column length for all the columns.. Right?
I am trying to create a program that transfers tables to flat files. At this point in time, I have suceeded in created one that creates delimited files.
However, I am now trying to create fixed-width files as you can do with the SSIS designer, but programatically.
Is there a way to programatically determine the width of a column from the source table? I can not seem to find any kind of function or member that stores this information or allows me to retrieve it.
I know what I need to change in order to set a width for a column, but I just don't know how to find the width without just asking the user to provide one.
We have some reports that have optional columns. We have them working very nicely, with the column showing or hiding based on values in the report -- works great.
Except -- when the columns are present, the report spans onto two pages, when exported to PDF, in width. That's understandable, as there's a lot of extra data, and exactly what we want. However, when the columns are not present, we get empty pages instead, because the report doesn't automatically contract back onto the size that fits on one page.
Changing the report to a Matrix won't work, as the hidden columns on some of these come as sets of three, where each column in the three has different formatting (different widths, format codes, etc).
I have a problem using the table object. I have columns that I sometimes want to show, and I want the page to run off the edge and be two pages. However, usually I'm hiding many of the columns and the table "shrinks" enough to fit on one page. When this happens, the table looks right on the first page, but I get blank pages after it, because the report itself will not shrink.
I have some data that was entered in the DB in ALL CAPS. I would like to reformat all the rows so that it follows the normal "Capitalization". What is the best way to do this? Shoud I create a console application to accomplish this or is there some way to do it natively in sql server 2005.
How to modify/change data that is in a SQL table column. Here is what I need or have
I have 2 tables, Table 1 and Table 2, within those 2 tables there is 1 Column that has the same column heading aswell as data within,(I will call it the serial_number column) there is also a 2nd column that is labeled the Same in both tables, I would like to be able to update the Values in the 2nd column of table 1 with the values from table 2 column 3, using the Serial_number column as my matching reference between the 2, the data is not in the same order between the 2 Tables,
More or less I need to set the value of table 1/column 2 to match table 2/column 3, where the serial_numbers are the same in both tables serial_number columns, the data being changed is set as Small int...
Hi Every1, I'm getting this error. 'Cannot specify a column width on data type smalldatetime.' I'm using SQL Server & I've check the data type in the db & it's same as smalldatetime. Any suggestions would be highly appreciated. Thanks
<Error>
Column or parameter #8: Cannot specify a column width on data type smalldatetime. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.SqlClient.SqlException: Column or parameter #8: Cannot specify a column width on data type smalldatetime.
Source Error:
Line 344: Try Line 345: myConnection.Open() Line 346: dgdSearch.DataSource = myCommand.ExecuteReader() Line 347: dgdSearch.DataBind() Line 348: Finally
I need to change the value of column mimetype in table data, but only for these entries which have the value 144 in column "Subtype" in table dtr.
Here is my sql:
with cte as ( select DataID, SubType, MimeType from dtr A1, data A2 where A1.dataid=A2.Docid And A1.Subtype='144' AND A2.mimetype='application/news-message-id' ) update cte set MimeType = 'application/x-outlook-msg'
I've tested it and it works. Do you see any problems with this SQL?
As updates are risky I'll do a database backup. Is it possible to get all changed entries so that I can track my update, because I don't have a report about the changes? Maybe that everythin is transferred to an output file?
When i create a temp table with a field as blank string as in following example and then try to insert a blank string int it following error is coing. compatibility level of database is 70
following is the example
Select CtpId = convert(int, a.CtpId), a.OrgId, a.Sname, a.Intls, a.Prfx, a.CallName, a.Sex, a.RspblEmp, City = convert(char(40), ''), OrgDescr = convert(char(46), ''), a.ActvtyStatus, a.Sales, a.SaleCntct, a.ContractCntct, a.ContractSigner, a.CRW, a.WkndCntct, a.UseOrgAddr, CtpTimeStamp = convert(int, a.TimeStamp), FrequentFlyer = convert(bit,0) , a.PrevCmpl, b.St, a.DtIns into #Ctp from tbCtp a, tbAddr b where 0 = 1
Select a.CtpId, a.OrgId, a.Sname, a.Intls, a.Prfx, a.CallName, a.Sex, a.RspblEmp, City = '', OrgDescr = '', a.ActvtyStatus, a.Sales, a.SaleCntct, a.ContractCntct, a.ContractSigner, a.CRW, a.WkndCntct, a.UseOrgAddr, CtpTimeStamp = convert(int, a.TimeStamp),FrequentFlyer = 0, a.PrevCmpl, St = "", a.DtIns into #CTP from tbctp a where a.Sname like 'as%' and CallName = '%'
ERROR MESSAGE:: Server: Msg 2731, Level 16, State 1, Line 1 "The width of column 'City' is 0. This width is not valid."
I have been looking over the forums looking for answers to the question that nails us all: how do you dynamically resize column widths? MS says: you don't. However, I have heard many people say they have found ways around it. I wonder if anyone might share those with me (and everyone else). Share the wisdom you have gained with those less experienced!
Hi, I have a SP which returns a select query on a temp table so I get to choose column names when I create the #table.
Can I determine column names myself based on the results of another query (in the SP) before, or (preferably) after I create the #table and populate it.
My query is used to bind to a datagrid so I could use....
dataGrid.Columns[index].HeaderText and set it to a particular output parameter, but I want to keep the code in the SQL.
I am using SQL Server 2000 Enterprise Edition fully patched. Database is in Simple Recovery mode.
I need to change a column's data type from "int(4)" to "smallint(2)". I know for sure that there will be no data (precision) lost, because I know the possible values that this column could have.
My problem is that the table I am dealing with has 600,000,000 records in it. I dropped all indexes before I tried to alter the table. But still it is taking forever and filling up my 280GB disk with transaction log file.
I know that in Oracle, if I want I can turn off logging and do these kind of modifications relatively faster.
I was wondering if there is a way of disabling logging before running this alter command.
What is the best practice to handle a situation of this sort?
Say you have an existing populated SQL 2005 database, with 700+ tables, and you want to just change the order of the columns inside every table. Short of manually building conversion scripts, anyone know an automated way to do this? I was thinking thru ways to do them all in one shot, and have tools like Erwin and DbGhost that could be used also. Basically moving some standard audit columns from the end of the tables to just after the PK columns.
I use bcp command to output to excel, it works. But I want to format the excel, some column width are too small,user need adjust the column width, otherwise it shows ######.
How can I set columns width when I use bcp output to excel.
Also, can bcp command output to multiple excel sheets and add report title in each excel sheet?
We are generating RDL file on the fly using a XSLT. We are trying to implement an auto width to all the columns dislpayed in the Report. Is Automatic horizontal width for column supported in RDL? If so how? If not is there is any workaround for it?
We tried using CanGrow and CanShrink tags, but those are for only vertical.
I store files in db in sql server 2008 by filestream. But when a column would be added to table which have filestream, properties of table would be changed. by every things change on table, retrieve files will faced to error. but store process work probably.
and filestream filegroup at following address will be empty. why?
Right click on table --> properties --> storage --> filestream filegroup
I have a subreport on my main report, and the subreport contains a matrix. When I run the report, the subreport seems to expand beyond the width of the main report. The matrix itself does not expand beyond the width of the body of the main report, but for some reason it seems that the subreport does. The subreport does not contain any headers that might be messing up the width. If I cut and paste the matrix from the subreport directly onto the main report, and remove the subreport, it prints fine. But as soon as I include the subreport on the main report it prints with blank pages because the subreport expands beyond the width of the body of the main report. I have checked the width and margins on the subreport and compared to the width of the main report and all looks good. Can anyone help?
Hi All, Is there a way by which we can modify the width of a column of a table which is being replicated without touching the ongoing transactional replication? This is for MSSQL2000 Transactional Replication.
I know (and successfully tried) that we can add a column to a table and that gets propaged to the replicate database and indeed the added column gets reflected there. How to add a column? sp_repaddcolumn or Right Click on the Publication-Properties and it shows a button to Add a Column.
This is what I have tried for modifying the width of a column of a table participating in Transactional Replication from varchar(10) to varchar(100)
MH (source) -> MH1 (Replicate)
The column “col1” had width of varchar(10) and this was altered to varchar(100).
I am trying to eliminate the extra space in columns that have been returned from a DB query...the tables have character lengths of 40, I would like to return just the necessary characters.
I have a report that has a certain number of columns that are hidden and when hidden they leave a lot of white space. Is there a way to detect when they are hidden and set the width property to 0 and then reverse the value when they are visible?
I would like to create a function that will return to me the width of the column of the table without giving as a parameter the table name. I need it, as I want to exceed my data in this column to the column length. I want to fill the column data with trailing blanks until I reach the column width. The function len returns the length of the data in the column.
I know that If I have the table name I can find the column width through the system tables. I don€™t want this.
I need to update a large table, about 55 million rows, without filling the transaction log, in the shortest time as possible. The goal is to alter the table and change the data type for Text column from VARCHAR(7900) to NVARCHAR(MAX).
Since I cannot do it with an ALTER TABLE statement (it would fill up the transaction log) I'm thinking to:
- rename column Text in Text_OLD - add Text column of type NVARCHAR(MAX) - copy values in batches from Text_OLD to Text
The table is defined like:
create table DATATEXT( rID INTEGER NOT NULL, sID INTEGER NOT NULL, pID INTEGER NOT NULL, cID INTEGER NOT NULL, err TINYINT NOT NULL,
[Code] ....
I've thought about a stored procedure doing this but how to copy values in batch from Text_OLD to Text.
The code I would start with (doing just this part) is the following, but maybe there are more efficient ways to do it, or at least there's a better way to select @startSeq in the WHILE loop (avoiding to select a bunch of 100000 sequences and later selecting the max).
declare @startSeq timestamp declare @lastSeq timestamp select @lastSeq = MAX(sequence) from [DATATEXT] where [Text] is null select @startSeq = MIN(Sequence) FROM [DATATEXT] where [Text]is null BEGIN TRANSACTION T1 WHILE @startSeq < @lastSeq