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 strongm 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: druer
  • Order by date
  1. druer

    Create Same Tables in Multiple Databases - SQL Server 2005 SSIS

    If you don't want to use the MODEL database approach so that the databases are created with what you need ... 1. You can do a select of master..sysdatabases to find databases with a name like you've identified and put that into a cursor to loop through: select * from master..sysdatabases where...
  2. druer

    SQL Server version control?

    All SQL objects are inheritantly just plain ASCII text. So any version control is fine. In the past I've used Visual Source Safe, but there are also other tools that integrate into Visual Studio to make things easy. I think that with SQL Server 2005 you could have alerts put in place when...
  3. druer

    Any idea on why store procedure is so slow

    I read that the database settings are the same, but are the indexes for the underlying tables also the same? Are the command options for SQL Server perhaps AWE also the same so that SQL Server can use additional memory you might have? Are the disks/drive arrays also being used as they are on...
  4. druer

    Create Same Tables in Multiple Databases - SQL Server 2005 SSIS

    Are you looking for the SQL to find the right databases, or the sql to create the tables? Another option is to create the tables you want in the MODEL database, so that each time you create a new DB it will already get the table schemas you have defined. Hope it helps, Dalton PS - Not liking...
  5. druer

    Is there a way to get the accurate file size for a particular DB?

    Or you can run the following to find the sizes for all data/log files for all databases in your system: exec master.dbo.sp_MSforeachdb 'use ? select db_name() as dbname, * from sysfiles'
  6. druer

    What would be a database efficient approach?

    Very excellent solution jegaby. "If it was a snake it would have bitten" the rest of us as they would say.
  7. druer

    I need assistance with a SELECT query.

    Glad Unclerico was able to help you out.
  8. druer

    What would be a database efficient approach?

    So basically you are saying that up to this point those who called and were satisfied were recorded to a table with basically a testimonial and date, and that calls where the customer complained were just dropped on the floor and not recorded at all in the database. Interesting way for the...
  9. druer

    I need assistance with a SELECT query.

    What would you expect to see if you didn't have a 456EFG record without the (fi) on the end? Or what happens if the '456EFG' and '456EFG (fi)' records contain a different value for description and location? (And the answer they will ALWAYS be the same isn't the right one. Unless you tell me that...
  10. druer

    What would be a database efficient approach?

    I think I'm lost on the whole idea that there is anything to distinguish a Customer Satisfaction verse Disatisfaction record. A Customer Satisfaction record in nature contain values regarding a customers level of satisifcation: What do you think of our quality? (1, 2, 3, 4, 5) where 1 means we...
  11. druer

    TSQL - How do I use Cursor to query other dbs and return a new RS?

    I had a little fun learning on this and what I found was that I could select the value of the ? if I wrapped it in quotes. In the above the DB_NAME() function is used to get the name, in the below I wrap the ? in quotes and get the database name as well. You still need all of the above EXEC...
  12. druer

    TSQL - How do I use Cursor to query other dbs and return a new RS?

    I'm not sure what you mean by each table. Are you looking to find out which users "OWN" tables in the databse, or users that have some permissions to the database?
  13. druer

    update syntax question

    You might want to fire a second query after the preivous one using ".name2" in case you have situations where "name2" is the last in the text. But it wouldn't update those cases where "name2" was the first one. Hope it helps, Dalton
  14. druer

    TSQL - How do I use Cursor to query other dbs and return a new RS?

    Consider avoiding the cursor by using the undocumented stored procedure "sp_MSforeachdb" that will loop through all databases for you. I've pasted an example below that was copied from elsewhere simply as an example to get you started. You'll obviously want to use a different command. EXEC...
  15. druer

    Upadting a numeric field

    I think the idea of updating the field is a bad plan, unless that will be done at the same time as an application conversion so that all new data goes into the field already divided by 100 at the same time. The way you asked the question implies that you will have mixed values in the table some...
  16. druer

    Copy over users

    I'm thinking that copying sysusers probably won't work, but if you do a select against the sysusers from the starting database, and then create dynamic sql statement to add a user with the logon name from the query you should be good to go. Hope it helps, Dalton
  17. druer

    Returning top n% of each group in a table...

    Assuming the proper indexes to satisfy the query that should be cake and shouldn't take long at all. If the right query is taking too long then the problem is likely with the lack of indexes to resolve it. Dalton
  18. druer

    RESEED in order

    I didn't even think about the varchar aspect. But if that is the only reason, then the order by could just be done as Cust_Num, Convert(int, Line_Num) so it would sort correctly. (Right?) You had me worried that somehow if sorted data goes into a table as a single insert like that the server...
  19. druer

    RESEED in order

    Denis, I know enough to believe you, and your ;-( indicates that you understand my confusion, puzzlement and bewilderment. Thanks, Dalton
  20. druer

    RESEED in order

    I'm not sure why: Create table RealTable( cust_num, line_num, identity_field) insert into realtable select cust_num, line_num from old_table order by cust_num, line_num won't give you exactly what you want. The data going into the new table would be in exactly the order you want it to be, and...

Part and Inventory Search

Back
Top