Lets say I have an integer value which would fit into a smallint field
but the field is actually defined as int or even larger as bigint.
What would that "cost" me ? How would definitions larger than I need for
the values in the field affect me ?
Its obvious that the volume of the database would grow but with the size
of resources etc that we have nowadays disc space isn't a problem like
it used to be and i/o is much faster and many people would tell me "who
cares" , or IS it a problem ?
How does it affect performance of data retrieves ? Searches ? Updates
and inserts ? How would it affect all db access if tables are pointing
at each other with foreign keys ?
I was wondering if there is an easy way to get a database schema out of a MS SQL 7 database indicating specs on each field (datatype,length,table it resides in, whether it allows nulls, default values, primary keys, foreign keys, etc.)
when to use table variable and temp table. i told the interviewer that when rows is less like hundreds or thousand then use table variable else use temp table.After that he asked that what do u mean by less data or thousand rows may be there are multiple columns involved with that less rows and make a huge data set.
the application will add items into a "bag". That is, the items in one table will refer a record in another table. This will be done in timely manner -- with second or minute delays between adding a new item. There will be up to thouthand of items per bag. The option is to wait until a full bag accumulates and set up all the references at once by using
UPDATE items SET container_ref = bag WHERE id IN [...]
The disadvantage of such all-at-once I see is inability to encapsulate the functionality into a SP -- the problem is to pass a set of IDs. The advantage should be efficiency in terms of total SQL Server load. How mush would it be?
1. To combine all the company's data in one large database, and use schemas and file groups to create logical and physical distribution on drives and namespaces
or
2. Distribute the data into smaller databases with related data - eg. products and product description in one db, Customers in another and orders and orderlines in a third db.
System.OverflowException: Value was either too large or too small for an Int32. Why does this error originate in the following line?"SqlCommand cmd = new SqlCommand("SELECT Count(*) FROM Contacts", conn)........ ..........DataSetContacts.ContactsRow row = ds.Contacts.NewContactsRow();..................row["ContactNumber"] = Convert.ToInt32(txtContactNo.Text);" ContactNumber field is SqlDbType.Int.
Please could you tell me how big sql tables are when people refer to them as small, medium and large? Preferably in terms of disk space or rows (each row in my table will contain a standard length job advert and 20 additional columns with an average of 8 characters)
My Stored Proc runs through a loop and concats the contents of each field into one big nvarchar. Procedure works fine on a smaller scale but now it is being implemented on a very large table and the results of the sequel overflow the nvarchar limits. I looked into using text and ntext but both cannot be declared locally. Does anyone know how I can work aroudn this limitation?
Summary:The problem is that the temporary variable I am using (nvarchar) is too small to contain the robust size that the SQL is concating into it. The final field it winds up in is a text field and will be able to handle the amount of data, its just getting the data there is the issue..... Your thoughts please....
I have a field that is stored as a smalldatetime but I want to filter on that field only for the date. How do I ignore the time stamp and only go by the date?
I have a small number of rows in a dataset, Table 1. There is a CLOB on a large dataset, Table 2. They join on a PK. I would like to retrieve this CLOB and add it to the data flow for Table1. In short I want to emulate the following:
Table 1: Small table without CLOB, 10 rows. Table 2: Large table with CLOB, 10,000,000 rows
select CLOB from table2 where pk = (select pk from table1)
I want this to return the CLOBs for the small number of rows in Table 1. The PK is indexed obviously so it should be a fast look up.
Table 1 and Table 2 live on different Oracle databases. How do I perform this operation efficiently in SSIS? It seems the Lookup and Merge Join wont do this.
I have a table that holds a large amount of text in a field that is the body of the email. For example, it might say something like:
Quote: Email tech support at thisemail@email.com if you have any questions about the results of this test.
I need to change the email address in this field. Using this example I need to change thisemail@email.com to thatemail@email.com; however I do not want to change the other text in that field.
It is also important to note that the rest of the body of the emails stored here is different depending on the email.
So basically what I need is a statement that would look at a particular field, search for an email address, and replace that email address with another one without disturbing the rest of the text in that field. I already checked the w3 update tutorial and the update there is for the entire field.
SET numDeterminationLevelTypeId = parent.numDeterminationLevelTypeId,
numInherentRiskID = parent.numInherentRiskID,
numControlRiskID = parent.numControlRiskID,
numCombinedRiskID = parent.numCombinedRiskID,
numApproachTypeId = parent.numApproachTypeId,
bInherentRiskIsAffirmed = 0,
bControlRiskIsAffirmed = 0,
bCombinedRiskIsAffirmed = 0,
bApproachTypeIsAffirmed = 0,
bCommentsIsAffirmed = 0
FROM EngagementAuditAreas WITH(NOLOCK) ...
And what I need is to conditionalize the values of the "IsAffirmed" fields by looking at their corresponding "num" fields. Something like this (which doesn't work).
UPDATE EngagementAuditAreas
SET numDeterminationLevelTypeId = parent.numDeterminationLevelTypeId,
numInherentRiskID = parent.numInherentRiskID,
numControlRiskID = parent.numControlRiskID,
numCombinedRiskID = parent.numCombinedRiskID,
numApproachTypeId = parent.numApproachTypeId,
bInherentRiskIsAffirmed = (numInherentRiskID IS NULL),
bControlRiskIsAffirmed = (numControlRiskID IS NULL),
bCombinedRiskIsAffirmed = (numCombinedRiskID IS NULL),
bApproachTypeIsAffirmed = (numApproachTypeID IS NULL),
bCommentsIsAffirmed = (parent.txtComments IS NULL)
I have set up transaction replication between two databases. Data from a table in the first database is replicated to the same table in another database.
The table at the publisher already has some data in it. The table at the subscriber is empty. When the replication is synchronizing, I get the following errors in the replication monitor: *The process could not bulk copy into table "dbo"."virtualdatalocations_waitingqueues". (Source: MSSQL_REPL, Error number: MSSQL_REPL20037) Get help: http://help/MSSQL_REPL20037 *Field size too large
The table looks like this: CREATE TABLE virtualdatalocations_waitingqueues ( dataid int , personid int , queueid int , CONSTRAINT FK_vw_dataid FOREIGN KEY(dataid) REFERENCES datalocations(id) ON DELETE CASCADE , CONSTRAINT FK_vw_personid FOREIGN KEY(personid) REFERENCES persons(id), CONSTRAINT FK_vw_queueid FOREIGN KEY(queueid)REFERENCES waitingqueues(id) );
It used to run fine in the past. I couldn't find any help on google or on forums.
I'm importing a large text field from an Excel spreadsheet into my Sql dbase using Enterprise Manager and I'm getting the error message "Data for source column 31 'fieldname' is too large for the specified buffer size." How do I go about changing the buffer size to allow for larger text fields? Thank you.
I have an tab delimiter ed file that I'm trying to load into a database using SSIS. The the database have a column called Comments that can hold up to 1000 Unicode characters (nvarchar[1000])
I have appropriately defined the flat file connection and marked every field to the intended length, but every time I run it it will give me the following error:
Data conversion failed. The data conversion for column "COMMENTS" returned status value 4 and status text "Text was truncated or one or more characters had no match in the target code page. All the columns have a match, this specific column is has no field longer than 1000, larger record has 528 characters in it and the fields are defined as Unicode string in the file connection.
I already ran out of ideas of what may be giving this error, anyone has an idea of what else to try?
I am making a SSIS package that imports data from a application using a custom ODBC driver. The field in the application is set to be a "longvarchar" type field and can be from 2 characters to 2MB of data.
I've created a ODBC data connection in the SSIS package and use a "DataReader Source" to read the data I need. The sql statement is very simple
Select log from tablename When I try to run the SSIS package with that statement it just goes to yellow on the DataReader Source and stops. It stays like that until I stop it. If I select other fields except for that field it works fine. Also I've been able to get it to succeed getting the log field if I select a log record that's not too big. The largest one I've been able to get is 800 characters, but I got one with 2500 characters that just stops on yellow.
In the Progress log the last line says:
[DTS.Pipeline] Information: Execute phase is beginning. Does anyone have any ideas on how to resolve this?
Hi, Ive got a report using a List item that is vertically displaying the columns from a table. The problem I run into, is that some of the fields in this table contain large blocks of text where the users have entered comments and such.
I am using Textboxes to display this data.
So my report will look something like ----- Field label 1 Field value 1 Field label 2 Field value 2 Field label 3
<white space>
<page break>
Field value 3 ---> this is a big block of text Field label 4 Field value 4 etc ------ It appears as though the report attempts to keep the contents of each textbox together even if that means breaking onto an entirely new page to do this. I would prefer for the data to flow more natrually instead where the page breaks in the middle of the data being displayed should it be too large to fit on the page it started on.
----- Field label 1 Field value 1 Field label 2 Field value 2 Field label 3 Field value 3 --- As much as can fit on this page
<page break>
Field value 3 ---> remaining data that broke over the page Field label 4 Field value 4 etc ------
Create table code ( id identity(1,1) code parentcode internalreference)
There are other columns but I have omitted them for clarity.
The clustered index is on the ID.
There are indexes on the code, parentcode and internalreference columns.
The problem is the table stores a parentcode with an internalreference and around 2000 codes which are children of the parentcode. I realise the table is very badly designed, but the company love orms!!
The table currently holds around 300 millions rows.
The application does the following two queries to find the first internalreference of a code and the last internal refernce of a code:
--Find first internalrefernce SELECT TOP 1 ID, InternalReference FROM code WHERE ParentCode = 'M222' Order By InternalReference
-- Find last ineternalreference SELECT TOP 1 ID, InternalReference FROM code WHERE ParentCode = 'M222' Order By InternalReference DESC
These queries are running for a very long time, only because of the sort. If I run the query without the sort, then they return the results instantly, but obviously this doesn't find the first and last internalreference for a parentCode.
I realize the best way to fix this is to redesign the table, but I cannot do that at this time.
Is there a better way to do this so that two queries which individually run very slowly, can be combined into one that is more efficient?
I've got two databases on the same server and replicate some tables from one database to another.The replication is configured so not to drop the table if it exists, but to delete the data based on the filter if one exists. There are two tables on the subscriber that have some extra columns.
I get "field size too large" error when trying to replicate them. Is there a workaround without having to make the publisher and the subscriber tables identical by schema?
Hi every one, I am facing problem in printing the reports from browser and also when i export it to pdf,the problem i am facing is blank pages are coming when report column getting the large amount of text around 2500 characters into column value. can any one help me in this issue?. if the report is getting acceptable amout of data it is printing in proper way i.e no balnk pages at all.i maintained all properties like margins+body size < page size.
I am going to start a database and need to know the difference betweenData Modeling, Schema and Database design?I always thought of Data Modeling and schema as defining relationshipsand primary and secondary key?What is mean when someone designs an E-R diagram and a Data FlowDiagram??
I am setting up columns in a data table. Where can I find the definitions and uses for all the items on the DATA TYPE drop down list such as ntext and nchar? The data type list is also found under column properties general section.
Hi all, After installing SP2 for SQL2005, My boss has found new reports when looking for database information. Specifically, the new Reports option when right clicking on a database.
To better streamline our dbs he found a pair of Index reports that he does not know what to do with. Can anyone help us understand the time length for the numbers shown under #User Seeks, #User Scans, #User Updates, Last User Seek Time, Last User Scan Time, etc..? We are unsure if these are daily, or from the last backup, or for uptime since last restart, or collected from the inception of the database.
Any help would be good and very much appreciated as I am VERY new to this and would like to show that I can find information when asked.
I use SQLServer 2008 R2 Standard Edition.I know there are some triggers in my database that someone else has created, but I can't find their names and also I want to know the definitions of the triggers, if I want to alter or recreate them.
Does anybody know where to find out the definition of all the SQL error code For example, What does error code 4002 means ? What does error code 3146 means ? Thanks.
Where can i find more information on the table definitions? I am trying to understand the definition of User.AuthType & User.UserType. There should be some sort of documentation somewhere.
When I add a user to a report or folder it will assign it to UserType = 1, AuthType = 3. I have no idea what that means.
Other than the error log is there an easy way to find the sort order and chracter set of an installed SQL Server. Also after finding the numbers is there a good reference to tell you what these numbers mean. Thanks
Hi All, In SQL Server 7, we had the option of opening a previously saved trace template and running it inorder to run a previously saved trace defintion repeatedly. File > Open > Trace Definition and choosing the Trace Name. Clicking OK would run the trace.
How do we do the same in SQL Server 2000? File > Open > Trace Template opens a Trace template but has only a 'Save' button and I'm therefore unable to run it.
How is it possible to run a previously defined trace repeatedly in SQL server 2000? Thanks in advance, Praveena