Hot answers tagged

6

Something like this may do the trick. I just quickly modified something I use for a slightly different purpose. declare @dbname varchar(80), @lastfull datetime, @fullback varchar(1024), @position int, @SQL nvarchar(max) set @dbname = 'YourDB' select @lastfull = MAX(backup_finish_date) FROM master.sys.databases d LEFT ...


4

I would attach the files to a new database, script the table and re-create it in your active database. First up, move the *.mdf and *.ldf files to the default database file locations. This way, they'll inherit the appropriate file level permissions. Now, create a new database from the existing files, but using a new name: USE master GO CREATE DATABASE ...


3

Essentially, you're trying to work around what appears to be somebody else's bad implementation. That seems reasonable to me, and sometimes, that's a necessity. If this program is indeed "crashing" when trying to connect to one database but not another, as opposed to, oh, you know, displaying an error message, that's pretty weak. I have a standby solution ...


3

While you certainly could use techniques like SSH port forwarding to make a remote listening TCP socket appear like a local one, it probably would not be of any help. If your client is "crashing" upon connection, it most likely would not stop doing so just because you are using a different destination IP address. There might be a myriad of reasons why the ...


3

There are solutions to this problem all over the forum and blog sites @MonkeyMagix. What you need to do is restore the msdb backup as msdb_old (or something similar), then run code against the _old DB to 1) build the code that creates the Agent jobs from the _old DB; http://www.sqlservercentral.com/scripts/generate+jobs+scipts/68105/ or 2) insert the ...


3

In my experience, detach/attach is the fastest method. The bottleneck would probably be how quickly you could copy the files across the network. Assuming the two databases have identical Windows accounts (if you're using SQL accounts you may have to update SIDs), you could probably use something like this script that I have laying around from before I ...


3

Different databases use different network protocols. tsql only works with MS SQL and Sybase. That's actually an exception to the general rule, because they historically came from the same codebase. For Postgres, you need the command-line client psql, or (as you mentioned already) the Postgres ODBC driver, or a program build using the Postgres C client ...


2

Your query is returning memory used by SQL, not the max server memory it's allowed to consume. How do you get the minimum and maximum memory allocation of a SQL instance using T-SQL? This will show you how to get that value via query. SELECT name, value, value_in_use, [description] FROM sys.configurations WHERE name like '%server memory%' ORDER BY name ...


1

Try something like this based upon the dm_operation_status DMV: while ( select top 1 state_desc from sys.dm_operation_status WHERE resource_type_desc = 'Database' AND major_resource_id = @db AND operation = 'ALTER DATABASE' order by start_time desc ) in ('PENDING', 'IN_PROGRESS') begin print 'waiting for operation to complete: '...


1

You need to encapsulate your column names with square brackets, otherwise SQL Server will interpret the spaces and dashes as part of the statement instead of the column name. SET @sSQL = 'UPDATE #tempProcsAndJobs SET [' + @columnName + '] = 1 WHERE createStatement LIKE ''%' + @columnName + '%'''; EXECUTE (@sSQL); This will result in the following ...


1

The other answers seem to suggest you should get the application fixed - this is not always possible in reality, so here's a bit of a band-aid/paper clip/bubble gum fix. I haven't tried this with MSSQL, but for MySQL, I was able to configure TCP proxying via Nginx. The setup would be to deploy Nginx on the same box as your application, with config like that ...


Only top voted, non community-wiki answers of a minimum length are eligible