Transact-SQL is the Microsoft extension of ANSI standard SQL.
Questions tagged [tsql]
59 questions
1
vote
1 answer
Why do I get different memory numbers using TSQL versus the GUI?
I'm preparing to bump up our max server memory value after a RAM upgrade on our server. I'm testing the commands out on a test SQL Server and I'm not sure why I'm seeing different results with T-SQL versus the GUI.
I changed the memory on the test…

cspell
- 195
- 1
- 2
- 6
1
vote
3 answers
SELECT from inline CSV values in MS SQL
I occasionally get one-off requests to modify some data, and the request comes with some values in CSV. Is there a way I can treat arbitrary CSV as a table or row source quickly and easily, even as inline data?
EG, can I do something like:
SELECT *…

Chris Wenham
- 189
- 1
- 1
- 8
1
vote
1 answer
MSSQL: Roll back DB from backed up .MDF/.LDF
I've mistakenly deleted a table in Microsoft Server Management Studio, and the restore function was not properly configured.
I have older .mdf and .ldf files of the particular db with the deleted table in it. How would I properly restore the older…

zillaofthegods
- 113
- 5
1
vote
3 answers
Spoof database connection to be local instead of remote
I am trying to connect one of our clients "as is" programs to a remote database instead of a local one, they think that they have coded it to work that way, but for some reason the program crashes when trying to connect to a remote database. I don't…

spydon
- 133
- 1
- 1
- 9
1
vote
1 answer
Unable to change schema of a Publication Database using TSQL (Ready-roll): being forced stop replication
I am trying to apply schema changes using T-SQL (using Ready-Roll database source control tool with Octopus Deployment) to a Publication database however it is forcing me stop Replication for the script to run. If it matters, I am running…

Daniel
- 11
- 1
1
vote
1 answer
Information on TSQL DelBkUps parameter
We are using a TSQL script to back up our database every night, and in this scrip it uses -DelBkUps 1DAYS to remove the old disk copy of the backup. However we are running out of disk space at the moment and I would like to change this to something…

sec_goat
- 169
- 1
- 1
- 13
1
vote
1 answer
Can I split open/divide a large MS SQL disk media set?
MSSQL 2005
An old maintenance plan was backing up a database to a single disk based media set with append. It contains numerous full backups of about 2GB each. I now have a single media set file almost 0.5TB in size.
Is it possible to easily split…

iWeasel
- 161
- 8
1
vote
2 answers
SQL Server 2008 - Backup Databases with more than 50 characters
I am using T-SQL to backup my MS SQL 2008 databases:
BACKUP DATABASE @name TO DISK = @fileName
The problem occurs when it comes to the databases with their name length greater than 50 characters like this one:
I then get this error:
I know that…

Jonathan Rioux
- 1,938
- 6
- 33
- 57
1
vote
1 answer
SQL Server database backups storage
This is rather basic question.
We do backups of all the databases on the server and size around 20GB every week.
All that is scheduled (shrinking,Backing up)
We store them on Network drive.
Now that the .bak files have grown in number (lets say 10…

evenprime
- 111
- 3
1
vote
3 answers
T-SQL query to schedule the back-up by using Transactional logs!sql server 2008
Hello i am new to sql server and i don't know any thing about backing up database using tsql i am trying to find out the procedure to do following but unsuccessful.
T-SQL query to schedule the back-up by using Transactional logs on every Monday at…

pixelerator
- 121
- 4
1
vote
1 answer
GRANT PERMISSIONS ON SQL Server 2008,
I got the following issues while querying a database, and somehow I am not yet able to resolve it.
1. The SELECT permission was denied on the object
So I executed the following command on SSMS ( I am the sa )
2. GRANT SELECT ON [PQR].[dbo].[XYZ]
to…

user67714
- 357
- 1
- 4
- 12
1
vote
1 answer
SQLS Timeouts - High Reads in Profiler
I've audited a SQLS2008 server with Profiler for one day.. the overhead didn't seem to trouble this new client my company has. They are using a legacy VB6 application as a front-end. They're experiencing timeouts once SQLS RAM usage is high.
The…

lb01
- 113
- 5
1
vote
1 answer
T-SQL Maintanance Plan
This runs as a weelky Maintanace Plan but I am not sure what it actually does.
Any clues?
declare @dt datetime
select @dt = getdate()-30
exec msdb.dbo.sp_delete_backuphistory @dt
EXEC msdb.dbo.sp_purge_jobhistory @oldest_date=@dt
EXECUTE…

Andy
- 199
- 1
- 6
1
vote
1 answer
How do I get SQL Profiler to show statements with column names like 'password'?
I'm profiling a database just now and need to see the UPDATE and INSERT statements being executed on a particular table.
However, because the table has a 'Password' column the SQL Profiler is being understandingly cautious and replacing the TextData…

Kev
- 7,877
- 18
- 81
- 108
1
vote
1 answer
T-SQL for autogrowth of multiple data files
I can't seem to figure out the problems with my script to alter SQL Server 2008 database and file growth. There are two data files and a log file, all which need to have Autogrowth ON. Does this look completely wrong? Thanks!
USE MASTER
GO
ALTER…

Ddono25
- 165
- 3
- 13