I have a stored procedure that runs nightly, called by a batch command on my database server. The procedure logs everything it does into a log table:
create table log_tab
(
logdate smalldatetime
,logevent varchar(200)
)
both fields are populated through the procedure as such:
insert...
Hello,
I am adding a trigger for a table that updates a "status" field on the table being updated, as well as the update ID and update date.
In addition, I need to log the updates in a separate table to track all changes, not just the most recent. Here is what I have. This works, however I...
the problem is i have nothing to order it by. The file is not really "table ready". I need to re-structure the data once it is in my table so I can start manipulating it.
In the file, there is a transaction indicator. The following rows are all associated with that transaction, until the...
I am trying to import a flat file into a new table and I need the records to insert into the table in the same order they appear in the file. There are about 30,000 records total, and I think they start getting out of order in the 20,000 or so. I am importing the file into a 1 column table...
Perfect!
SQL Dennis, I am going to look into the RANK(), as I am using SQL 2005, but only for 1 server.
ESquared, your second option works so much better than my cursor! Thanks... your first option gave me the result of 1 for every record.
Thank You All
SQLDennis, I do already have an identity column in there. I am trying to make an identity-like column, but it needs to start over for each rectype. So for example, my table looks like this:
pk_identity trans_id rectype rectype_id
1 1 HDR NULL
2 1 HDR NULL
3 1 TND NULL
4 1 TND NULL
5 5 HDR...
I am trying to run the below cursor to sequentially number the records for each "rectype" in a transaction each starting at 1. The problem is this took 35 minutes to run on my sample of 46,000 records. I could potentially have over a million at a time in production.
Thank You in advance for...
try this one:
IF exists ( select 'x'
from sysobjects
where uid = (
select uid
from sysusers
where name = 'user1'
)
and name = 'table1' )
begin
sp_changeobjectowner 'db1.user1.table1', 'user2'
end
are the fields you are using in the criteria indexed?
( T_PAY.creat_dt, t_pay.tnnt_id )
if they are not, indexing them should help speed things up for you.
It is a good idea to store the file information in the database along with the file to make finding the file-type and other important information easier. I am going to see what I can do about having that added.
The datalength function worked perfect to find the largest sized records.
Thank...
I have a table that has approx 14,000 records in it. 2 of the fields are image fields. The table takes up more than 8 gigabytes, and the database has only been in production for 3 months. Data will be retained in the table for close to 5 years. I am trying to identify which records have the...
there is a stored procedure called sp_spaceused that can be used to calculate the size of the database,
like execute sp_spaceused
or to calculate the size of a single table,
like execute sp_spaceused 'table_name'
that should do the trick.
cfw2
does anyone know of a way to identify the size of a or each record in a table?
I have a table that is used as a central storage place for different types of files. There are 2 fields in the table that are image datatype.
I am able to identify the size of the table, I would like to go into...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.