Tagged Questions

Microsoft's SQL Server is a relational database management system (RDBMS) that runs as a server providing multi-user access to a number of databases. It originated from the Sybase SQL Server codebase, which is why both products use the extension of SQL called Transact-SQL (T-SQL).

learn more… | top users | synonyms (2)

1
vote
3answers
57 views

How to get random samples from a table? I don't want repeated records between samples [closed]

I have this problem, I want to get some random extracts from a table and I dont want repeated records between those extracts, in order that when I join all the different samples together, they look as ...
1
vote
1answer
54 views

TempDB Log Space and ACTIVE_TRANSACTION

Our monitoring solution (SCOM) is currently flagging that the tempdb log is running out of space. However we have auto grow set to 1GB chunks for the log and we have 25GB of space left on the drive. ...
0
votes
1answer
23 views

Database Recovery Stuck on “Restoring”

Scenario: Sql Server Database routinely backed up with Backup Statement below. The "Recovery Model" was set to "Full" (we usually have them set to "Simple"). The ldf file, which had gotten quite ...
0
votes
0answers
39 views

What is the best way to create a database diagram for SQL Azure without having to install SQL Server?

I have a database on SQL Azure and want to create a database diagram for that, but don't want to have to install SQL server and copy the database etc. Is there any way that I can do it that anyone ...
0
votes
1answer
43 views

Help with optimising a sql query on two partitioned tables

I have a SQL query that I am running on two very large tables in SQL Server 2012 Enterprise The two tables are ACKs and Logs. Both are partitioned on their time by day column with the appropriate ...
0
votes
1answer
46 views

Unable to copy a DB from SQL Server 2000 to SQL Server 2012 using copy wizard

I am trying to copy a database from SQL Server 2000 to SQL Server 2012 using copy wizard in my local machine where SQL Server 2012 is installed. But, the wizard is not detecting destination server. ...
8
votes
1answer
121 views

Clustered Columnstore indexes in SQL Serer 2014 for data warehousing

I am performance tuning a DWH using indexes. I Am fairly new to SQL Server 2014. MS describes the following: "We view the clustered columnstore index as the standard for storing large data ...
2
votes
2answers
144 views

Select from stored procedure

Hello I have a table called Workers in my database. Also I have a stored procedure that returns a table with Id, xml Data and xml Schema by Worker.Id. I want to select all Worker.Id values and execute ...
1
vote
1answer
23 views

How to add an extended property to a table type?

According to the MSDN documentation, 'TABLE_TYPE' is a valid value for the @level1type parameter as shown below. EXEC sys.sp_addextendedproperty @name = N'MS_Description', @value = N'An INT ...
-1
votes
1answer
37 views

Is there a way to copy/initialize values in a set

What I want to do (I know this does not work) is: update stats set BandwidthLastMonth = BandwidthThisMonth, BandwidthThisMonth=0 where myPk = 3 Is there a way to do this in a select ...
1
vote
0answers
52 views

Why does SSAS keep restarting every few seconds?

We have a SQL Server 2005 Analysis Server which began restarting this weekend, seemingly without any external changes. The current state of the server is that as long as the SSAS service is enabled, ...
0
votes
2answers
54 views

Identical Servers but different query execution plans [duplicate]

We have two server with identical hardware configuration and SQL server configuration. The only difference in the server's being: Server SQL1 - 256 GB RAM Server SQL2 - 128 GB RAM The same database ...
0
votes
2answers
40 views

How to I establish a 1 to 1 relationship

I have a table Nurse: CREATE TABLE [dbo].[Nurse]( [EmployeeId] [int] IDENTITY(1,1) NOT NULL, [WardId] [int] NOT NULL, CONSTRAINT [PK_Nurse] PRIMARY KEY CLUSTERED ( [EmployeeId] ASC ...
2
votes
1answer
39 views

Defining a column as nullable in a view (but not in the referenced table)

My company is working on implementing a new HR application that will unify our existing HR processes. We've run into a bit of a sticking point, though; according to business rules, the EmployeeID and ...
1
vote
2answers
169 views

Should these two indexes suggested by the SSMS missing index feature be combined?

I'm trying to improve the performance of a specific query that is automatically generated by Entity Framework. I have run the query through SSMS, and it has suggested creating two missing indexes. ...
0
votes
1answer
53 views

Looking for a snippet illustrating ambiguous result of a join in a where clause

A while ago (around 2004) I worked as a back-end developer on a team where everyone used the where clause joins. As a proponent of using inner/outer joins instead, I showed them an example of a where ...
2
votes
2answers
100 views

Make sure partitioning is working

I created a partition for a table. There is a column "archived" (tinyint). 0 goes to PRIMARY data file, 1 to ARCHIVED data file. ALTER DATABASE MYDB ADD FILEGROUP [ARCHIVED]; ALTER DATABASE MYDB ADD ...
0
votes
1answer
48 views

Best way to transfer a few tables from reserve server to production

We have two MS SQL Servers (2012 Standard Edition on Windows 2012 Server) which are located in the same subnet. One is production server. Another is reserve server. Currently there is a ...
0
votes
1answer
29 views

moving all databases from SQL 2005 EXPRESS SP2 to SQL2005 Enterprise SP4

Thank you for such a great forums on web. I'm not a DBA specialist and my knowledge about SQL server is low so this simple issue is getting challenging for me. We have an old SQL Server express 2005 ...
0
votes
2answers
32 views

Design a Lab Report tables [closed]

I need to design tables for a laboratory test. I will have Lab test name, and its component to be saved. The component can be changed with time. I need to design a UI for update. Also each ...
0
votes
2answers
35 views

Error with making backup in sql Server

We have a win server where installed sql server 2008. When I try to backup database, I have an error. Is anybody know what is the error? TITLE: Microsoft SQL Server Management Studio ...
0
votes
1answer
45 views

CTE returns an empty set even though anchor is non-empty

I'm got an adjacency list consisting of two tables: CREATE TABLE permission (id SMALLINT AUTO_INCREMENT(-32768, 1) PRIMARY KEY); CREATE TABLE permission_graph (parent_id SMALLINT NOT NULL, child_id ...
0
votes
1answer
57 views

Procedure with Insert Data From One Table to Another Table

I have two tables Person with PersonId, Name,Address,Mobile and PersonLog with Id,Name,Address,Mobile,FK_PersonId. I am trying store the old data in PersonLog and Person to be updated. This is my ...
0
votes
0answers
22 views

How to retrive output depending on last alphabet from entry in table [migrated]

I have table User with Id, Name. So depending on last alphabet from column Name, i need to output some text. If last char is 'o' should return YES, if is 'i' return NO, else null Ex. Monika ...
-3
votes
1answer
44 views

xml values are not inserting into the table

Here is my code: ALTER PROCEDURE sp_Insertxmldata @xml xml AS BEGIN declare @hdoc as int EXEC sp_xml_preparedocument @hdoc output,@xml Insert into ...
0
votes
2answers
70 views

SQL join with multiple columns as FK to same list table

I have a table that has 5 references to a list table for normalization of the first table. So in the table 1 a row looks line other columns..., reference_1, reference_2, reference_3, reference_4, ...
0
votes
1answer
58 views

Package performs differently on two different instances on the same server

I'm investigating some performance issues for our BI team. They have a package which runs extremely slow and will sometimes run indefinitely on one instance but finishes normally on another instance. ...
0
votes
0answers
48 views

SQL Mirroring synchronize logins and agent jobs

We have just started using SQL Server mirroring for several clients on SQL Server 2008 R2 Standard. We've got the SQL Server mirroring working fine however now we run into the issue of replicating ...
1
vote
2answers
46 views

Compress files and directories into zip file and put it into blob field

What is the best way to do the following using SQL Server? Compress all the files, folders and subfolders from a specific location (specified in a parameter in a stored procedure) - the server side ...
3
votes
1answer
143 views

Cannot attach the AdventureWorks database

I am trying to attach the AdventureWorks database with the following query: CREATE DATABASE AdventureWorks2012 ON (FILENAME = 'C:\AdventureWorks2012_Data.mdf') FOR ATTACH_REBUILD_LOG ; But I get ...
1
vote
1answer
42 views

Why are users allowed to connect to SQL Server when creating sql account, that defaults login to 'master" for login

When a new login is created in SQL Server it automatically defaults database to master. We do not give permissions in master (systemdb) but in our user DB (CustomersDB) with db_datareader and ...
1
vote
2answers
55 views

How do I know if a AWS Server instance has license SQL Server Standard or SQL Server Web?

I'm looking my AWS billing and this doubt has come up. How do I know if a specific instance is running SQL Server 2008-R2 Standard or SQL Server Web? (using the AWS Console or SQL Server Management ...
1
vote
2answers
56 views

Unique column values between tables

I'm keeping track of teams and their members. Each team has one leader, one contact person, and any number of players, and each of them has a unique email address. The problem is that one physical ...
0
votes
1answer
90 views

Conversion failed when converting the varchar value to data type int in SQL Server

While getting some data input, for below query, encountered Convertion failed error:- SELECT a.ProcessInstanceAppianID, a.ProcessInstanceDescription, CONVERT (INT, ...
1
vote
2answers
47 views

Build Restore History table

We restore a database daily that we download from an FTP site. I would like to build a history table that tracks when the database is restored on our SQL Server. This is easy. My issue is sometime ...
0
votes
3answers
55 views

Resume job 'A' at some step till job 'B' is completed

I have two SQL Agent jobs 'A' and 'B' Job 'A' has 10 Steps and it starts at 5:00 Am as per schedule, job 'B' has 5 Steps and it Starts by using trigger in step 3 of job 'A', job 'B' should be ...
7
votes
1answer
124 views

T-SQL - OPTION (FAST x) and trace flag 8722

I have searched a long time and still haven't found the answer to my problem. Our Dynamics AX is generating queries with the query hint OPTION (FAST x), which sometimes forces a bad execution plan to ...
0
votes
1answer
29 views

SQL Server: Clarity on which service user does what (backups, etc) RE accessing network shares

To backup / restore to or from a network share, either the SQLServer or SQLAgent user needs access to that share. Which is it? SQL itself or the agent? And then how? (I wanted to create the ...
0
votes
1answer
33 views

How can I give a group of developers the ability to view the query plan, without the ability to run a trace or to view the server state?

I have a group of 5 developers that need to be able to view the plans of queries they have written for a database, and that database only. I refuse to make them a member of sysadmin. I do not want ...
-3
votes
3answers
110 views

How to query from a linked server via a linked server in sql server?

I have the following set-up: SQL-Server 1 --linked--> SQL-Server 2 --linked-> SQL-Server 3 The question is can I query SQL Server 3 from SQL Server 1 via SQL Server 2? I have ...
0
votes
0answers
28 views

SQL Server 2012 Replication Subsystem Increase Number of Working Threads

I am trying to create Transaction Replication (Push) between two servers, using a distribution database on a3rd server. Server 1 is SQL Server 2008, Server 2 is SQL Server 2012. The Distribution ...
0
votes
0answers
12 views

SQL server - copying tables, constraints and indexes from one database server to another server [duplicate]

An accidental DBA, We have sql server 2012 on both of our payroll production server and development server. We have to copy few tables and indexes and constraints from the production database to the ...
0
votes
2answers
51 views

How to set host_name() value in a Sql Server Stored Procedure?

We have existing triggers which read the workstation id property of the connection string using host_name(). There are existing PowerBuilder client applications connecting to the database directly ...
0
votes
1answer
65 views

READ_COMMITTED_SNAPSHOT locking on Non-Clustered Index

I'm in big trouble with one database instance of SQL Server 2008 R2. I have this structure that I've created it to simulate my real problem: USE [sor] GO ALTER DATABASE [sor] SET ...
1
vote
0answers
26 views

How To Log Select Statements from 1 User On 1 Table Into a Permanent Log Table

We have a centralized authentication library that 100+ applications use to authenticate users. That library has its own DB credentials. It would be extremely useful to log every time that library/user ...
0
votes
1answer
51 views

How Can I restore a database to a point of time without Old backup? [duplicate]

I have a database in full recovery mode with five tables. I accidentally deleted one table. I don't have any old backups. Can I restore the database with five tables?
1
vote
1answer
55 views

Remote linked servers

I have a SQL Server 2008R2, and I want to connect remotely to a SQL Server 2012SP1, for which I am given: IP: 12.34.56.78 Login: john Password: pw1 Database: TESTDB Table: test_table The remote ...
2
votes
3answers
104 views

Non clustered index on multiple columns

I have a table which has around 50 columns. But there are only 6 columns on which we perform regular search. When I am trying to create a non clustered index on it I am getting the warning of 900 ...
1
vote
1answer
40 views

How can I log the way in which a job was started?

Using SQL Server Agent, I've created a Job that runs some SQL. This SQL does some work on one database, then adds a row to a logging table on a separate database. The Job is run on a couple of ...
2
votes
1answer
149 views

SQL Server Error log - strange date

The dates in the SQL Server error log look very strange. A subset for messages between Sep/29/2014 8:00 am and Sep/29/5:40pm show a date of Feb/16/2014. Have you seen this before? Any idea why the ...