Transact-SQL is the Microsoft extension of ANSI standard SQL.
Questions tagged [tsql]
59 questions
1
vote
2 answers
TempDB is Full Issue for SQL Server 2000
Even though the log file shows that there is over 1 GB of free space, we start receiving an error message every 3 or 4 days saying that the TempDB file is full. I know cursors impact the TempDB file, but is there anything else I should be looking at…

Jason N. Gaylord
- 223
- 3
- 11
1
vote
1 answer
Deleting text files based on date through SQL Server T-SQL
I need to delete .txt files in a particular directory based on date. Can I do this through T-SQL?

SuperCoolMoss
- 1,262
- 11
- 20
1
vote
2 answers
select values must match the number of insert columns
I have the following query... ive checked and rechecked the types and number of values in both the insert into and the select statements. I can't figure out what is wrong.
insert into [Subscription].dbo.SUBSCRIPTION (
CreateDate,
…

Rod Johnson
- 453
- 1
- 4
- 7
0
votes
1 answer
How to use variables in inner queries?
I am trying to build a query that has something like this
select
id,
(select top 1 create_date from table2
where table1id = t1.id
and status = 'success') [last_success_date],
(select count(*) from table2
…

Rod Johnson
- 453
- 1
- 4
- 7
0
votes
0 answers
php 7 on Fedora 27: Uncaught Error: Call to undefined function sqlsrv_connect()
I have installed sqlsrv & pdo_sqlsrv per
https://github.com/Microsoft/msphpsql/tree/PHP-7.0-Linux
I created a test program that works perfectly from the command line but not when viewed in a web page.
If I put…

faultintolerant
- 23
- 3
0
votes
1 answer
Object definition in MS SQL 2000
I was looking for a way to generate object definition (in my case stored procedure defintion) in SQL 2000 like I can get in SQL 2005 : select definition from sys.all_sql_modules.

Paul
- 714
- 2
- 6
- 19
0
votes
1 answer
Interpreting a Deadlock Log / XDL file
I've generated the following XML + XDL:

SB2055
- 33
- 5
0
votes
1 answer
Convert into multiple data ranges
I have employee data link below
This is one example in the file a have multiple lines. Initial input can have more than 2 lines for each employee but convert logic will be the same.
Thank you for help!

user3030648
- 1
- 1
0
votes
1 answer
Is it possible to connect to a PostgreSQL server using FreeTDS driver and tsql?
Can I make a connection to a PostgreSQL server using FreeTDS, more specifically tsql command?
I've been trying for a few days now, using many different configurations. Even though I am able to connect to the DB using isql and PostgreSQL odbc driver,…

brunodea
- 3
- 2
0
votes
1 answer
Bring back to restoring state an online database
I configured logshipping for a database. I did some tests and tried a controlled failover.
During log shipping secondary db is in restoring state.
To have a controlled failover i stopped the primary database.
then i put online my secondary db…

giammin
- 107
- 2
- 8
0
votes
1 answer
T-SQL Code to backup database with multiple files failed
I'm trying to write an automated script that will allow me to backup the database to a NAS with multiple files. I just started to use T-SQL.
My objective is to automatically calculate the size of the database and divide it by 4 (4 GB), the result…

Blake Zero
- 107
- 1
- 2
- 9
0
votes
1 answer
Deal with dashes and spaces in T-SQL String functions
I am searching for the occurrence of a string in a field on a table. The search statement is done through dynamic sql with my statement template looking like this.
SET @sSQL = 'UPDATE #tempProcsAndJobs SET ' +
@columnName + ' = 1 WHERE…

Black Dynamite
- 523
- 2
- 5
- 16
0
votes
1 answer
SQL for duplicating parent and children records
I'm trying to figure out the best way to create a SQL statement (in SQL Server) to duplicate a parent record and all the children records. I have the below as an example;
-- duplicate the order
insert into Orders (CustomerID, EmployeeID, OrderDate,…
0
votes
1 answer
MS SQL Server 2008 R2 downloads for practice
I plan to download MS SQL Server 2008 R2 SP1 - Express Edition. I know I need one of the two applications to download with it: 1) SQL Server 2008 R2 Express with Tools and 2) SQL Server 2008 R2 - Management Studio Express. Which one (1 or 2) is…

Allan D
- 1
0
votes
1 answer
Creating a SQL Server 2005 User Login to Backup and Restore on a Single Database
I have a SQL Server 2005 database server with multiple databases on the server. I need to create a user login 'test1'with the following restrictions:
Login 'test1' should be owner of database 'ABC' only and no other database on the server.
Login…
Stephen