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...
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...
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...
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...
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'
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...
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...
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...
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...
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?
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
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...
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...
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
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
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...
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...
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.