Transact-SQL is the Microsoft extension of ANSI standard SQL.
Questions tagged [tsql]
59 questions
0
votes
1 answer
Error on creating job SQL Server 2005
Error on creating job:
Unable to cast object of type
'Microsoft.SqlServer.Management.Smo.SimpleObjectKey' to type
'Microsoft.SqlServer.Management.Smo.Agent.JobObjectKey'.
(Microsoft.SqlServer.Smo)
SQL Server:
Microsoft SQL Server 2005 -…

Kashif
- 193
- 2
- 11
0
votes
1 answer
MSSQL2005: is there a sproc to set the default distribution agent profile?
I'm trying to work out how to set the default profile for the distribution agent programatically using t-sql. I see there is the sp_help_agent_profile and sp_help_agent_default sprocs which allow you to find out what the default is, but they don't…

simon
- 714
- 1
- 7
- 21
0
votes
1 answer
Does SQL Server/ T-SQL really adhere to E F Codd;s Relational Model of Databases?
The relational model as proposed by Codd heavily relies on Set Theory and Predicate Logic. Does SQL Server really adhere ?

Maximusawesome
- 111
- 4
0
votes
2 answers
How to keep Ms-SQL database always UP: mirroring or replicationg?
I have several Tb databases in the Windows Server 2008.
I would like to keep alive the service when the server is failing or the raids are needs to be rebuild.
Which model to choose Replication or Mirroring?
And how to setup that the alive server…

Arman
- 575
- 2
- 8
- 18
0
votes
1 answer
Attaching MDF File that appears to have been truncated by the OS
I've got an MDF and LDF file from a dead server that I'm trying to attach to another instance of SQL Server. However running the following create database statement
USE [master]
GO
CREATE DATABASE [DBName] ON
( FILENAME = N'C:\tmp\DBName.mdf' ),
(…

Robb
- 103
- 1
- 3
0
votes
1 answer
Verify SQL Server Mirroring failover is successful
We have database mirroring configured as "high safety without automatic failover" on 23 databases. Both partners contain principal and mirror databases. I created two scripts that would failover either mirror or principal with either a graceful or…

Ddono25
- 165
- 3
- 13
0
votes
1 answer
Automatically drop FK's to re-create a table and then automatically put the FK's back
I have a number of incidents where SSMS tells me table recreation is required, even for something simple like making a column nullable. If this table is referenced by FK's, I would ideally like to find a way of temporarily removing those FK's from…

ProfK
- 493
- 5
- 9
- 28
0
votes
3 answers
query maintenance plan schedule
can I query the schedule of a maintenance plan? I want to automate checking that backups were run.
Thanks
Jim
0
votes
1 answer
how to show table data as columns in tsql
I have 2 tables in sql-server 2005 express DB
1. ItemSize Table
CREATE TABLE [dbo].[ItemSize](
[ID] [int] IDENTITY(1,1) NOT NULL,
[iSize] [int] NULL
) ON [PRIMARY]
2. SalesLog Table
CREATE TABLE [dbo].[SalesLog](
[SalesID] [int] IDENTITY(1,1) NOT…

Raj
- 145
- 6
0
votes
2 answers
Cannot drop a table in SQL 2005
I have a SQL Server 2005 SP3 box that one of my developers created a temp table on that we cannot seem to remove because it somehow got brackets in the name of the table?
SELECT Name, object_id FROM sys.objects WHERE Name LIKE…

David Mathis
- 898
- 2
- 9
- 21
0
votes
2 answers
SQL Passing a List as a SqlCommand Parameter
can i pass a List into a SqlCommand as a paramter?
DELETE FROM MyTable WHERE Key IN @MyParam
command.Parameters.AddValue("MyParam",MyList);
i realize i could just loop over the list but i was looking for a cleaner solution.

KellCOMnet
- 245
- 2
- 11
0
votes
1 answer
SSRS/Sharepoint - Reports made in Report Builder not being list in Sharepoint Web Part
I followed the steps here to integrate reporting services with sharepoint in native mode.
I made a page in Sharepoint with the report explorer web part and everything is working.
The issue is when I create a report with the web based report builder…

Greg_the_Ant
- 489
- 7
- 26
0
votes
1 answer
Alter Database recovery model & Shrink log, DB dynamically
I normally do on daily basis these operations in GUI
Alter database to simple recovery model
shrink log file
shrink database file
Alter database to full recovery model
I can understand script but can't write one.
I just want to give DB name then…

Shadow777
- 9
- 3
0
votes
1 answer
Detect when scaling Azure SQL database via async TSQL command has failed
I have a scheduled task which runs each night to copy an existing production Azure SQL db to a dev environment. Once copied, I scale the database down (actually I put it into an elastic pool to share the cost amongst multiple other dbs) to reduce…

theyetiman
- 111
- 5