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
37 views

Database design for large incoming data

I've been tasked to design a database to handle a large volume of incoming traffic from sensor readings, possibly 1,000s an hour when it's at full strength. Each reading will be relatively short - ...
0
votes
0answers
43 views

SQL Server 2000 Named Instance cannot connect remotely

To facilitate a migration I installed SQL Server 2000 Standard Edition and Service Pack 4 as a named instance on server with an existing instance of SQL Server 2008R2 RTM. The issue I have is ...
2
votes
0answers
57 views

Stored Procedure slow after weekend

When I come to work on monday some stored procedures take several minutes to execute and STATISTICS IO shows a lot of PHYSICAL READS and READ AHEADS going on. However, after running the procedures ...
0
votes
0answers
22 views

The OLE DB provider “SQLNCLI10” for linked server “(null)” indicates that either the object has no columns or

When I run the following script its run fine merge RDW_RRR_MAIN_ST.dbo.tmps AS dest USING (select * from RDW_RRR_MAIN_ST.dbo.tmprole cross join RDW_RRR_MAIN_ST.dbo.tmpscreen) as src1 on ...
1
vote
3answers
98 views

Preventing SQL Injection

I know that this is very dangerous: EXEC sp_executesql 'SELECT * FROM ' + @Table But, is this safe from SQL injection? IF EXISTS(SELECT * FROM information_schema.tables WHERE TABLE_NAME = @Table) ...
21
votes
8answers
1k views

Security implications of restoring a backup from an unknown source?

Scenario: You're handed a database backup and told to restore it to a server (that's already hosting other databases), but are given no useful information about what the backup contains or whether the ...
1
vote
0answers
16 views

Update Only Rows With Shared/Similar Value [migrated]

OK - I have a simple table - below - what I am trying to do is to identify only those rows that have a shared value - so anything that has a shared "apc" value - DO x else Do Y CREATE TABLE #test ...
0
votes
0answers
54 views

A working view now starts timing out

I have 2 identical databases (one larger, one smaller) with identical views. Recently a view on the smaller DB started timing out. Google searches seems to point to deadlocking of some sorts. If I ...
4
votes
1answer
62 views

Symmetric difference operation in Transact-SQL?

I have always known about the UNION operator in SQL, but only recently discovered that there were other set operators, INTERSECT and EXCEPT. I haven't been able to find an operator that does the ...
-4
votes
0answers
20 views

confused to implement condition in stored procedure [duplicate]

I want to prove two condition in my stored procedure as follows: if I found the same record in database, it should not save the record and return 1. if I found more than 4 records for the same ...
-3
votes
1answer
45 views

Getting number of errors in stored procedure [closed]

I am getting an error in stored procedure as follows: Msg 156, Level 15, State 1, Procedure K2_CHECKENTRYINFILELOG, Line 27 Incorrect syntax near the keyword 'if'. Msg 102, Level 15, State ...
0
votes
1answer
34 views

Sql Server sys.Traces log

Working with traces on production server I found some mysterious entries to me in sys.Traces, When I run below query it shows me status of all traces as ‘Paused’ along with entries in ...
-2
votes
0answers
66 views

Writing a Condition in a Stored Procedure Using If Exists

I have a stored procedure which is working. I want to check two condition in my stored procedure: If I found the same record in database it should not save the Record, it will return 1. If I found ...
0
votes
0answers
29 views

Can a stored procedure OUTPUT parameter return a table as output?

I would like to know whether we can use a stored procedure's OUTPUT parameter to a return table as result set? I would appreciate any practical example using it OUTPUT parameters in stored ...
2
votes
1answer
39 views

Can I replicate a database from SQL Server 2012 to SQL Server 2014 (with 2014 distributor)?

I am planning to have database replication running from SQL Server 2012 (publisher) to SQL Server 2014 (both distributor and subscriber) -- pull replication. Has anyone done this type of ...
0
votes
1answer
38 views

Upgrade SQL Server 2000 engine

I have SQL Server in which I need to upgrade and restore a .bak file Server 1: Microsoft SQL Server 2000 - 8.00.194 (Intel X86) And by requirements I need it to match Server 2: Microsoft ...
1
vote
0answers
46 views

Database Structure Definiton

This is a question more so on the table definition vs actual programming. I have 6 sets of potentially 255 unique fields. I have a potential of getting 40 million records per year of these. For the ...
4
votes
2answers
182 views

Repair SQL Server Database [closed]

Can anyone give me a complete guide to verifying/repairing a SQL Server database? At the moment our backup is failing on the Solarwinds database saying the database NetPerfMon is corrupted (we are ...
7
votes
3answers
163 views

Optimize select on subquery with COALESCE(…)

I have a large view that I use from within an application. I think I've narrowed down my performance problem, but I'm unsure how to fix it. A simplified version of the view looks like this: SELECT ...
1
vote
1answer
64 views

Enforce referential integrity between two groups of data

I have two sets of records: A collection of rules. A collection of actions to perform based on those rules. What I'm trying to model is something like this: Multiple rules can be grouped ...
1
vote
2answers
52 views

Using UNION (ALL) in a WHILE loop with SELECTto merge the result set for each iteration

When I am looping with WHILE in SQL Server 2012, if I use a SELECT statement it prints the column name for each iteration. Can I UNION all? Here is my sample query: CREATE PROC spGetChar @start ...
0
votes
2answers
57 views

Get the first and last names of all employee who entered the project at the same time as at least one other employee

SELECT EmpFname ,EmpLname FROM Employee_m WHERE ( SELECT COUNT (w1.EnterDate) FROM WorksOn_m w1,WorksOn_m w2 WHERE w1.EnterDate = ...
0
votes
1answer
55 views

When to rebuild and when to reorganize indexes [duplicate]

I have been trying to gather information about rebuilding and reorganizing indexes. From stackoverflow page (How Often should the indexes be re-build in sql-server DB?) i got this query : SELECT ...
0
votes
0answers
32 views

What's the optimum hardware configuration for a database?(SQL Server) [closed]

Database circumstances are different from place to place, but there are a few theoretical areas which should prove true for all circumstances. I think it would be great if it is summed up in one ...
0
votes
2answers
42 views

Does leaving a connection open for a matter of seconds cause deadlocks?

I have been testing a system application and have noticed that it is slow when it connects to the database overseas. This is to be expected to some extent, but there is a big difference with the ...
0
votes
0answers
69 views

SQL Server Perfmon % Processor Time unbalanced [closed]

I am somewhat of an accidental DBA, and I'm troubleshooting a SQL Server box where performance has been notoriously poor (as reported by the customer). I was not involved in the initial planning of ...
-2
votes
0answers
27 views

Procedure for monthly reports [closed]

I have table1 which have (empid,inpunch,outpunch,tdate) and another table2 for storing results in form of (empid, 1,2,3,4 ...,30) I need to write a procedure that inserts the inpunch and outpunch ...
1
vote
1answer
43 views

MS SQL Server 2012: once a day full replication (automatic backup/restore) for reporting

Our company is w/o a DBA, and it has fallen on me (a complete DB noob) to handle some critical database tasks. I'm looking for the best solution for us to be able to "copy" a full database to another ...
0
votes
0answers
32 views

Retrieve SPID For SSRS Request

Is it possible to determine what SPID was created to execute a SSRS report? I am trying to prevent users from running the same report multiple times. So what I was thinking of doing was retrieve the ...
2
votes
2answers
99 views

How I can force the TSQL-Developers to use not deprecated TSQL?

I want to avoid the using of deprecated code. Like the new feature Nr. 8 http://msdn.microsoft.com/en-us/library/ms178053.aspx I want to force them to use "WITH" for example, or a semicolon at the ...
3
votes
1answer
51 views

Adding warning with sp_add_alert doesn't work with “Greater Than” and SQL Server 2014

We upgraded our SQL Server from 2008 R2 to 2014. I want to add a custom warning. USE [msdb] GO EXEC msdb.dbo.sp_add_alert @name = N'MAN more than 1000', @enabled = 1, ...
1
vote
1answer
470 views

what is '#' in create table statement? [closed]

I recently saw a statement like: CREATE TABLE #tbl_AR_Data I wanted to know what is the purpose of the symbol # (NUMBER SIGN, hash, pound sign) in this statement?
0
votes
1answer
47 views

SQL Server 2008R2 Migration to new Platform - What Steps Required?

We are migrating our SQL Server 2008R2 instance from one Windows Server platform to another. SQL Server will remain as 2008R2. The new plaform will have more disk space, memory and CPU. I am doing up ...
1
vote
1answer
88 views

Two SQL Server databases setup with same .mdf and .ldf files

In a SQL Server 2008 R2 instance two databases (the second one being a restore/copy of the first one) have been setup against the same .mdf and .ldf files. How would I go about either deleting the ...
0
votes
0answers
34 views

Need some ideas for class/certification for Data Warehousing/Big Data [closed]

I am an ETL developer at a large company and have the opportunity to attend some training. I get to pick a few class's/certifications. What would this community recommend as best for someone that ...
1
vote
1answer
44 views

Does SQL Server 2014 Express, with Advanced Services, actually support full text search?

I've installed SQL Server 2014 Express edition, with advanced services. I was hoping to try out the full-text search features. I read here that full text search is supported by the 2014 express ...
0
votes
2answers
62 views

Are these linked server queries susceptible to SQL injection?

I'm using a stored procedure to generate a create table script on the fly based on parameters passed into it. I am validating that the server exists, and then validating if the table exists in the ...
1
vote
1answer
76 views

Use NOLOCK hint when calling table valued function

Suppose the following function: CREATE FUNCTION [dbo].[ufnTest]() RETURNS TABLE AS RETURN SELECT 1 AS Nr My actual function will select actual data from many different tables. I (mostly) understand ...
1
vote
1answer
82 views

SQL Datetime / datetimeoffset(2) comparison & implicit cast wierdness

I discovered a problem when inserting data in our database. My insert statement was checking for the existence of data in the WHERE clause to prevent duplicate data being inserted. None was detected, ...
3
votes
3answers
105 views

Log File Management - Space on Disk

At our organisation we have several non-Production environments where Developers run free and wild with TSQL code and databases. The DBA team do not normally monitor or maintain them. Recently several ...
4
votes
2answers
110 views

Clustered Table Scan Because of “SELECT *”

I have a Records table with over 100 columns and very many rows, and a nonclustered index on 5 fields based on my access paths: CREATE NONCLUSTERED INDEX [IX_Records_CustomerID] ON [dbo].[Records] ( ...
0
votes
2answers
49 views

Transfer all tables from a schema to other schema

I have two schema. Schema1 and Schema2 How would I transfer all the tables from schema1 to schema2?
2
votes
4answers
50 views

Null Or Multiple Parameters When Querying

I have a stored procedure that has a parameter that must take a comma delimited varchar list of values that can be turned into a table of values or can be NULL, such as @Values VARCHAR(10) = NULL ...
2
votes
0answers
77 views

How do I give file system access to SQL Server's SQLSERVERAGENT virtual account?

I'm trying to grant the NT Service\SQLSERVERAGENT Windows account file system access, based on the marked answer in this question. I believe it's a virtual service account, and it does not show up in ...
3
votes
1answer
73 views

Sargable Queries

Very simple question I hope, I'm currently having some scripts I inherited into my project reviewed by the database admins. This has never been done before apparently and lots of issues are being ...
1
vote
0answers
30 views

Creating SQL Azure login for single database

I want to create separate logins for each database we create on a SQL Azure database server which only have read / edit permissions for a single database and do not have drop permissions, and to ...
2
votes
0answers
65 views

Slow query execution using ODBC 32

When executing a simple select query on a SQL Server 2012 system, the execution time is very different if I use OLE or ODBC 32bit. Unfortunately I am forced to use ODBC 32bit. The Query: SELECT ...
0
votes
1answer
15 views

Deploy SSRS 2012 report to a distant Sharepoint 2010 server

My installation : - SQL server 2008 r2 + Sharepoint server (main farm) = VM1 - SQL server 2012 + SSRS 2012 (not native mode) = VM2 I would like, if possible , make my SSRS configuration manager ...
0
votes
1answer
38 views

Sending one email when all jobs completes successfully

I need to create backup jobs over several instances, I wonder if there is any way to send a single notification via mail only when jobs from all instances completed successfully.
1
vote
1answer
49 views

How does MS SQL Server authenticate MSDTC connections when using SSPI?

I'm trying to get SSPI authentication to play well with two-phase transactions via MSDTC, using PostgreSQL with psqlODBC. I can't figure out how it can work securely - so I'm hoping someone can ...