Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search results for query: *

  • Users: cfw2
  • Order by date
  1. cfw2

    datetime field with a getdate() default

    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...
  2. cfw2

    More Efficient Trigger

    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...
  3. cfw2

    Importing a Flat File with records importing sequentially

    it looks like there is not a simple command to do this. Thank you to everyone who replied.
  4. cfw2

    Importing a Flat File with records importing sequentially

    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...
  5. cfw2

    Importing a Flat File with records importing sequentially

    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...
  6. cfw2

    Need help with a more efficient cursor

    that did it... that one is actually faster than the second option you originally gave too. Thanks again, Charles
  7. cfw2

    Need help with a more efficient cursor

    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
  8. cfw2

    Need help with a more efficient cursor

    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...
  9. cfw2

    Need help with a more efficient cursor

    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...
  10. cfw2

    Scripting help

    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
  11. cfw2

    Creating a more efficient query

    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.
  12. cfw2

    image data-types

    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...
  13. cfw2

    image data-types

    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...
  14. cfw2

    A script to calculate the size of a database?

    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
  15. cfw2

    record size in table

    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...
  16. cfw2

    SQL Help Needed

    This query should work. select serial ,code from tblproduct where code in ('XAB','XAC','XAD') and serial in ( select serial from tblproduct group by serial having count(*) = 1 )
  17. cfw2

    help with a query - count(distinct x)

    I am trying to perform a count distinct, however I would like to count a distinct grouping of columns like so: select count(distinct field1) ,count( distinct field1, field2) from x anyone have any ideas? thank you, cfw2
  18. cfw2

    group by clause in a where exists subquery

    I am running a query similar to the one below, and it is not providing the information that is needed. select tdate ,store ,register ,cashier from table1 where exists (select 'x' from table2 where table2.tdate = table1.tdate and table2.cashier = table1.cashier and...

Part and Inventory Search

Back
Top