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
1answer
41 views

What permission do I need for viewing… all current user permissions?

I'm maintaining an application that runs with SQL Server 8.0.760 SP3. When I try to "see" the permissions of the current user I'm logged with, I do this: SELECT * FROM fn_my_permissions(NULL, ...
1
vote
2answers
45 views

How Can I Read Where TempDB's Files Will Be Created After Restoring Master DB?

I'm restoring to an alternate server in a DR drill and have restored master but can't restart the instance, even with /f and /m switches. The log is indicating tempdb can't be created, probably ...
2
votes
1answer
82 views

What is running on my server every night?

My data disk queue is high every night at about 1:00 AM UTC. I did sql profiler trace and found that there are many queries running at the same time similar to these: Can someone tell me what is ...
1
vote
2answers
36 views

How can I generate an .mdf file containing a subset of my tables and rows?

I need to provide some data to an organisation (lets call them DataCo) that we're working with. Since we're both SQL server shops, my counterpart at DataCo requested an .mdf file. However, our ...
1
vote
1answer
191 views

Why do ASC and DESC come *after* a CASE clause?

This query works: DECLARE @Ordering NVARCHAR(50) SET @Ordering = 'aggregateid' DECLARE @OrderDirectionInt INT SET @OrderDirectionInt = 0 --1 SELECT * FROM ( SELECT ROW_NUMBER() OVER ...
0
votes
1answer
41 views

Throw and RaiseError of level 16 do not cause alert to occur

The next alert has been created: USE [msdb] GO /****** Object: Alert [Notify] Script Date: 09/09/2014 11:38:31 ******/ EXEC msdb.dbo.sp_add_alert @name=N'Notify', @message_id=0, ...
5
votes
4answers
179 views

How do I tactfully bring up database shortcomings? [closed]

A little background: I recently inherited responsibility for support and development of a database application after the original developers left. Looking through the application, the database ...
8
votes
3answers
2k views

INSERT takes over 5 hours, when inserting more than specific number of rows

When inserting less then about 1,350,000 rows to the table it all takes about 2 minutes, however when number of inserted rows is bigger, then the time needed to insert data grows to about 5 hours. ...
0
votes
0answers
33 views

MSSQL Insert takes over 5 hours, when inserting more than specific number of rows [duplicate]

I have a question connected with MS SQL. When inserting less then about 1350000 rows to the table it all takes about 2 minutes, but when number of inserted rows is bigger, then a time needed to insert ...
2
votes
3answers
92 views

How to check history of primary node in AlwaysOn HA environment?

How do I see history of failovers of the primary node in cluster? I'm trying to figure out at what point secondary node started to act as primary. We are running Windows Server 2012 with SQL Server ...
-2
votes
0answers
42 views

Newly registered user to match with existing in db member [closed]

I have a database that contains my company clients info. We want to enable those clients to register on our website and see their data. How should be newly registered user matched with Client entity ...
2
votes
2answers
103 views

Transaction Log Backups

I am working on backup+recovery scenario and I came across a situation where I could not figure out how I would have to deal with it. We have couple databases where sometimes there may not be any ...
2
votes
1answer
31 views

SMSS 2014 Network Server browser is empty

I trying to setup a MSSQL 2014 environment and I installed SQL Server Management tools for a dedicated management computer to reach database server nodes easily without starting this resource-hungry ...
3
votes
3answers
192 views

Iterate through all non-system databases and empty them

On SQL Server 2012...I have multiple databases on a server used for training purposes. Periodically, these need to be cleared for a fresh start. When quantities of databases were small I would use ...
1
vote
1answer
179 views

Do SELECT (without ORDER BY) return the same message as RECEIVE?

My current client needs to be able to PEEK messages in a SQL Server Service Broker queue. The current implementation uses RECEIVE and rollback to peek. As that generates writes to the transaction ...
-1
votes
1answer
83 views

SQL import data when both source and destination has data and identity column

I am using Import and export data option to import data from one database to another database. Both database have similar structure of tables. All the tables have primary key which is identity ...
3
votes
1answer
43 views

Transforming multi column table to different structure table

I am a software developer who got data in the following format: TABLE [dbo].[SensorValues]( [timestamp] [datetime] NOT NULL, [Sensor1] [float] NULL, [Sensor2] [float] NULL, [Sensor3] ...
1
vote
3answers
99 views

SQL Server 2005 Log Truncate - how long for a 60Gb log; mins, hours or days? [closed]

I have taken over an old website. To cut a long story short the people that host the computer, backup all the database files, but there is no maintenance plan in place for the backup (e.g. they ...
2
votes
2answers
100 views

Restore database into new DB without replacing the file structure

Our Network Admin has setup a MS SQL 2012 server and wants the DBs setup so the database files are located on 4 different drives. My problem here is when I try to restore a DB from a different system ...
0
votes
0answers
15 views

How to transfer Right-to-Left text from Excel to SQL Server?

I have a collection of data in my Excel which the language is right-to-Left. My data collection is very large. I want to transfer this to my SQL Server database and insert the values into a table. ...
1
vote
3answers
102 views

Undo SQL UPDATE Azure DB

I have accidentally updated over 3,000 records in one of my tables hosted on Azure. This was not a transaction and I did not have any back ups for this table. I've read around and found ApexSQL Log ...
0
votes
0answers
22 views

Undo SQL Update Azure DB [duplicate]

I have accidentally updated over 3,000 records in one of my tables hosted on Azure. This was not a transaction and I did not have any back ups for this table. I've read around and found ApexSQL Log ...
0
votes
1answer
48 views

How to JOIN more than two tables?

Following is the schema of my Tables: Marks_Table (SubjectCode,TypeID,MarksObtd) Subjects_Table (SubjectCode, Subject) Types_Table (TypeID, Type) I want to Select the Marks_Table table with ...
-1
votes
2answers
77 views

Remove a character from a records enclosed between double quotes

Hi I table in which every row have data like: 0150566115,"HEALTH 401K","IC,ON","ICON HEALTH 401K",,,1,08/21/2014 What i want is to remove every comma(,) that is enclosed between double quotes " ". ...
1
vote
2answers
121 views

How to count the rows from 1 table but from two different column

SELECT distinct Major, COUNT(Major) AS MajorCount FROM [College Management System].[dbo].[ApplicantCourseDetails] group by Major SELECT distinct MinorI, COUNT(MinorI) AS MinorCount FROM [College ...
4
votes
1answer
176 views

Sql Server - Select while insert on another transaction gives unexpected results

I stumbled at situation that changes my knowledge about transactions and locking fundamentally (I don't know much though), and I need help to understand it. Let's say I have a table like this: ...
0
votes
1answer
70 views

Formatting the output of SQL Server query

I am new to SQL Server and SSRS...and am trying to get a matrix report formatted correctly. My query is: select e.name, ea.element, case when ea.element = 'projected_status' then 'Projected ...
3
votes
1answer
111 views

When to use With Recompile

I know what With Recompile means, and I know that it is not suggested at most of the times due to performance issues, no dmv's, etc.. Sometimes there are cases that it may help, but OPTION(RECOMPILE) ...
4
votes
3answers
361 views

CHECKPOINT or COMMIT writes to disk?

Let's say, for SQLServer2008R2 and higher, with full recovery mode databases. I always thought : When a transaction is commited (COMMIT), the transaction is written to the transaction log in RAM. ...
4
votes
1answer
51 views

Combining full-text and scalar index

Let's say we have a database of 12 million names and addresses that need to be searchable using full-text, but each row contains an integer value too, let's say COMPANYID. The table contains around ...
1
vote
2answers
43 views

SQL logins access

I am trying to set up a set of SQL logins (one for each developer) on a server who can have access to a given set of databases, currently the setup is as follows: Login 1: db_owner of databases 1, 2, ...
-2
votes
0answers
29 views

Midnight Datetime difference - SQL Oracle

We have an application which reads information from SQL and Oracle (testing purposes). A datetime value is placed inside the table: Example: 05/09/2014 00:00:00 When we have this date in SQL: The ...
1
vote
3answers
75 views

How to query for records based on most recent version

I have the following table structure ID, ORDERNUMBER, DATE, STATUS 1, 1, 1-1-01, proposal 2, 1, 1-2-01, proposal 3, 1, 1-3-01, active 4, 2, 1-1-02, proposal 5, 2, 1-2-02, cancelled 6, 3, 1-1-03, ...
0
votes
2answers
62 views

Shrink SQL Server DB By xgb

I'm trying to free up some space in a database, firstly by swapping out and archiving partitions. The DB is massive though, and i want to start freeing up some space on the drive, but I don't want to ...
1
vote
1answer
72 views

SQL Server 2008 logging [closed]

We have a SQL server that has been hardening per government STIGs. Right now we are generating almost 10GB of Transaction log every day. (run sharepoint and some other applications). I'm trying to ...
0
votes
1answer
31 views

Does SQL server 2008 log instance level security permission changes

I just recently logged onto one of our Test environments to find i did not have permissions, turns out my instance security Login had been disabled I have a feeling towards whom may have done this ...
0
votes
1answer
73 views

SQLIOSIM fails to run when using UNC path

I'm trying to run SQLIOSIM on NAS cluster's NTFS shared folder. Here's the command line: sqliosim.com -dir \\c16\vol1cifs -size 512 -d 600 But it repeatedly fails to create files during the ...
2
votes
1answer
136 views

Find if Column Belongs to User Table

I want to compute the number of columns with not null constraint in my database. So I thought about querying the table sys.all_columns: select * from sys.all_columns The problem is that it ...
-6
votes
1answer
57 views

SQL Server Restore Database Error [closed]

I get the below error for restoring some databases. Some restore ok. Others fail with this error... Cannot open backup device 'I:\Backups\TestDB.bak'. Operating system error 2(failed to retrieve text ...
1
vote
0answers
44 views

Problem with the db design occurred when deleting a record and its reference records

I have an application with the following tables inside it. Categories - CategoryID, CategoryName, CategoryTypeID, IsActive CategoryTypes - CategoryTypeID, CategoryTypeName, IsActive Items - ItemID, ...
1
vote
1answer
60 views

Query 2 servers in one SQL script

I have 2 databases on server A ("srvA") that I use to build a data cube on server B ("srvB"). It's taken me an embarrassingly long time to discover that populating my cubes fails because the batch ...
0
votes
2answers
40 views

Triggers not reflecting on procedure

I have a trigger create trigger flightinput2 on reservation after insert as begin update reservation set Departure_Airport='LDN', Arrival_Airport='KUL' where Flight_Code='EM0088' end ...
0
votes
1answer
34 views

Can a SQL Server Subscription Database be unsubscribed and used as standalone?

We've got a new server we want to migrate to and I have setup a Publication on the current production server as a Transactional publication. Since the subscribed database is up to date, I want to ...
2
votes
0answers
45 views

Domain name change of SQL servers involved in replication

I have a situation where client wants to change their domain name of servers hosting SQL Servers(e.g. from AB to CD). I have a transactional replication with updatable subscription configured with 1 ...
0
votes
1answer
26 views

Log Shipping Alert

I have 3 databases which I have took them offline and I have Log Shipping setup on them and I wanted to stop alerts for those databases. How can I do that? Thank You for help
0
votes
3answers
96 views

SQL Server Create Database File Error

I get the below error running a CREATE DATABASE script... CREATE FILE encountered operating system error 5(failed to retrieve text for this error. Reason: 15105) while attempting to open or create ...
2
votes
1answer
20 views

Database Migration - Create New Filegroup and Move Objects

We have built a new SQL Server Database server instance. I am migrating our databases from existing instance to the new server instance using Backup and Restore. One existing database has a single ...
3
votes
1answer
42 views

Corruption in D:\$MFT. How may this progress? I don't think CHECKDB is useful here?

I have a server that is reporting NTFS errors; one of the error messages implicates d:\$MFT as being possibly corrupt. My SQL data files reside on this drive. The Master File Table holds information ...
0
votes
0answers
31 views

Using CASE in CHECK Constraint [duplicate]

I cannot get SQL Server to parse my query as I tried to alter a table and add a constraint. like this: ALTER TABLE TaxVal ADD CONSTRAINT ch_taxVal CHECK (CASE WHEN Col1 IS NOT NULL THEN Col2 = 1 ELSE ...
0
votes
2answers
71 views

Database SQL Script very, very slow (string manipulation over 700k rows)

I have table containing 700,000 rows containing a string id field with values such as rec-232276-dup-0 and rec-354240-org. The rec- is constant but the other parts of the id can change. I want to ...