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)

0
votes
0answers
41 views

What is the bare minimum access needed in the public role?

I need to lock down access to a specific database for a user - they should only have access to execute a couple of stored procedures. However, by default the user gets everything in the "public" ...
0
votes
1answer
29 views

Querying multiple servers via CMS: When does [Server Name] become 'real'?

Maybe a silly question. I set up an CMS earlier this year, which has improved my work day immeasurably. Servers are split into appropriate groups, but occasionally I only need to target some servers ...
0
votes
1answer
41 views

Can not re-set [log_reuse_wait] after log back up

I have a SQL Server 2005 database in full recovery mode with the following stats: name XX state 0 state_desc ONLINE size 2620152 max_size -1 growth 128 Log File name XX_Log state 0 ...
2
votes
2answers
51 views

Scrubbing sensitive data

I am looking for an automated solution to scrub sensitive data from my prod environment to my DEV and DEVINT environments so that I don't have to write lots of code to get this done. Does anyone know ...
4
votes
2answers
418 views

Restored Database is different from the original

I have recently performed a restore of our data-warehouse staging database onto a separate instance in our dev environment. After the restore I did a comparison and it looks like the database sizes ...
0
votes
0answers
43 views

How to check if all the extendend stored procedures (xp_) are enabled or disabled?

These are the stored procedures that I want to check if they are enabled or disabled. xp_availablemedia xp_cmdshell xp_deletemail xp_dirtree xp_dropwebtask xp_enumerrorlogs xp_enumgroups ...
0
votes
1answer
42 views

how to select top ID from join operation and staging tables

I have this inner join from staging and operations table jobsCode I want to select the top surrogate key ID and get the Start_Date from this join my problem is my Query rerunning 2 records original ...
0
votes
0answers
57 views

Importing OLE Object from Access to SQL Server

I am trying to import a table from MS Access to MS SQL Server which contains a BLOB field which contains a .zip file. The zip file has two images. This field is null sometimes. I am using the Import ...
0
votes
2answers
46 views

Cannot find .bak in a backup file [closed]

My database backup works well or you can see the backup in the backup file. But the backup has no format of a backup file. I mean you cannot see the .bak associated with it, therefore unusable by ...
1
vote
1answer
54 views

The query processor could not produce a query plan

I'm getting this message: Msg 8624, Level 16, State 17, Line 1 Internal Query Processor Error: The query processor could not produce a query plan. For more information, contact Customer Support ...
1
vote
1answer
158 views

Transaction Log is big! But simple recovery mode is chosen!

I am wondering: We have a Database on our MS SQL Server 2012. The recovery mode is "simple". The DB itself is about 2.7GB big. I have an MAX Size for Trn-Log configured (3GB). Now i made a ...
0
votes
1answer
83 views

Generate All days in moth report using PIVOT of SQL server

My table, tblEmployeeScan(EMPLOYEE_ID varchar(7), ScannedTime) Everyday each employee scans 2 times, 1 time or 0 time Now I want to create store procedure Create proc spMonthScanReport @MONTH ...
0
votes
0answers
55 views

Accidentally deleted records in MS SQL Server 2014

I have a very big problem with SQL Server data lost. Recently, i have performed SQL replication. and i found out that all exising records/rows in the subscriber was totally erased and replaced by the ...
1
vote
0answers
45 views

SQL Server: Buffer page read/writes per second reported high

Our SQL Server is reporting high buffer page read/writes per second. Several documentation sources suggest these stats should be less than 90 per second. Our database server is reporting: counter ...
0
votes
0answers
41 views

Querying system tables from Linked Server

I am trying to query the syspublications table on Linked Server A from Server B. Both servers are running SQL Server 2012. Using this simple query on Server B: SELECT a.dest_table FROM ...
0
votes
1answer
59 views

Indexing a view with xQuery in it

I'm not sure if this can be done at all but if it can it would be a huge help. I have a system where I am not allowed to make changes to the database structures. I have yet to have code changes put ...
1
vote
3answers
111 views

Execute permission denied on object sp_start_job

I need to allow a user to kick of a specific agent job without having any ability to start other ones. To accomplish this, I've created the following procedure (simplified): ALTER PROCEDURE ...
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
55 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
44 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
124 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
170 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
102 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
49 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
33 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
71 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 ...