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

SSIS - This error is thrown by Connections collection when the specific connection element is not found

I am writing a package to upload result of query to FTP as CSV file. Package is working fine on local machine, but after transferring .dtsConfig and .dtsx on another environment it throws following ...
0
votes
1answer
53 views

Job showing the running sign but not currently running

I have a script to get the currently running jobs: -- get the running jobs --marcelo miorelli -- 10-dec-2013 SELECT sj.name ,DATEDIFF(SECOND,aj.start_execution_date,GetDate()) AS Seconds FROM ...
-3
votes
0answers
22 views

Clearing log files

How to clear/Shrink the Log file of a database when the database is in stand by mode. How to make a database from recovery mode(normal mode/with recovery) to standby mode.
1
vote
2answers
39 views

Delete duplicates with specific columns as identifier

I'm required to delete all duplicate entries of a table. The duplicates are identified by two non-key values num (int) and com (varbinary(512)).. My amateur-ish SQLfoo lead me to this non-functioning ...
2
votes
1answer
131 views

Checkpoints and Logging

I'm working on getting full grasp of logging architecture. Please correct me if I'm wrong here: I understand that a checkpoint occurs (also lazywriter) to write the dirty pages in the memory to the ...
-3
votes
0answers
29 views

help with views [on hold]

I have to create a view in SqlServer 2012 I have 4 tables connected to each other via ID and parent Id I need to fire a query like if the record of a table is not present in another table it shows a ...
0
votes
0answers
38 views

Backup table is larger than original table

I am cleaning up my database by deleting unwanted tables such as temp tables, backup tables. While doing clean up I see that I have a backup table and the original table. The size of the backup table ...
2
votes
2answers
33 views

Sqlserver: Get Meta-Info about TRN file

Is there any way to get the timespan of the data contained in a TRN-File? What I have: A backup of a transaction-log What I need: The timestamp of the first and the last entry inside the log ...
0
votes
1answer
49 views

What is my database name?

I'm trying to connect to a microsoft SQL database but I dont know its name. I suspect it will be something of the form servername\databasename It would be good if I could just use SELECT ...
0
votes
1answer
58 views

TSQL vs SSIS Lookup

I was trying to find some well performing Tsql equivalents for the SSIS Lookup component. Especially for Fact table loading. After few different query patterns the most obv performed the best: ...
0
votes
1answer
21 views

Import CSV file - dynamic path

I am trying to import a csv file dynamically. This works: BULK INSERT #CSV FROM 'C:\Users\MyName\Desktop\Players.csv' WITH ( FIELDTERMINATOR = ',', ROWTERMINATOR = '\n' ) I would like to ...
9
votes
2answers
270 views
+100

How to recursively find gaps where 90 days passed, between rows

This is a kind of trivial task in my C# homeworld, but I don't yet make it in SQL and would prefer to solve it set-based (without cursors). A resultset should come from a query like this. SELECT ...
0
votes
1answer
17 views

MySQL rapid Data Replication from multiple Databases

I am a Freelance Web Developer but not a Database Administrator at all except basic Database Operations like DML etc. Today I got a client asking me to develop a Web based application but there is a ...
1
vote
2answers
32 views

Granting permission on a particular job to execute on SQL Server 2005

An user is requesting permission on a particular job. How can I give him access on job activity monitor which shows only that requested job?
1
vote
0answers
15 views

reports on history table

Assume Trucks which travel between Cityies. I store the Cityies that a Truck has traveled to in TruckLocationHistory table, if the Truck is passing the City, State = Passed and if it gonna stays for ...
1
vote
1answer
50 views

Can I trigger events based on timestamp data or should I use polling?

I'm asking this question for SQL Server 2008+ but this could really be for any DBMS. Imagine you have scheduled data, something like: ID Data Timestamp 0 NULL 2014-11-22 1 ... ...
0
votes
1answer
42 views

self referencing tables with SQL and entity framework

I have many tables in a database and the tables are nearly identical. There are limitations currently on what objects reference other objects. For example I have company,contact and project. Contact ...
0
votes
0answers
55 views

Query execute slowly when changed compatibility Level of my database

I use SQL Server 2014 and have a database with compatibility level 110 (SQL Server 2012). also I have a stored procedure on it that execute about 10 second. When I change compatibility level of my ...
0
votes
0answers
26 views

problem in connecting SQL Server for internet access

I'm having a problem connecting SQL Server for internet access. I have built a test server so that I can play at home and not kill the works server. I've been trying for days and so far I have: My ...
-2
votes
0answers
46 views

Joining Multiple Tables in Sql Query [closed]

I have four tables with their attributes; namely Check_Gauge, Storage_Facility, Product, Product_Brought. The first three tables are related through their primary keys. Product_Brought is not ...
7
votes
2answers
311 views

How can I check for stored procedure consistency across multiples servers

I've got a stored procedure on 10 distinct servers, how can I check across all servers for stored procedure consistency? I'm currently pulling the definition for each server manually, and comparing ...
1
vote
0answers
21 views

Migration error: “Invalid date literal detected” when reading decimal

I'm attempting a migration from MSSQL to MySQL and keep coming across a "Invalid date literal detected" error when reading certain decimal columns. I'm running the following (all up-to-date as of ...
3
votes
1answer
157 views

Why do nonclustered Indexes use clustered indexes instead of the table data pages directly?

From a Microsoft Course (presented by a third party) I learned that when a table has a clustered index even non-clustered indexes hit the clustered index. When there is not a clustered index (Heap) ...
2
votes
0answers
48 views

How to UPDATE/DELETE/INSERT with Microsoft.ACE.OLEDB.12.0 as Linked Server in SQL Server 2012?

I need to update an Access 2003 database from SQL Server 2012 with the Microsoft.ACE.OLEDB.12.0 provider. As an administrator, everything works great. I can do Select, Insert, Update and Delete ...
1
vote
2answers
90 views

Using sp_BlitzIndex - Diagnosed as “Index Hoarder: Addicted to nulls” [duplicate]

Context: MS SQL Server 2012 In using Kendra Little's awesome tool, sp_BlitzIndex, a number of tables were diagnosed as "Index Hoarder: Addicted to nulls". I'm not looking for a debate over NULLs and ...
2
votes
1answer
28 views

How can one select a static value as a column based when using UNPIVOT?

I'm trying to unpivot a few columns in a table. This is for a reporting tool. The source data is already normalized. I am able to get my desired results with a series of UNION ALL statements. I can ...
0
votes
0answers
38 views

Availability Groups, Log File Backups and Recovering the Secondary

I am currently working on ironing out some kinks in a testing setup for our large (1.5TB+) database in an Availability group and have a few things I need some help with. Setup I have a two node ...
1
vote
2answers
57 views

Create SQL Script Repository [closed]

I need to get all my SQL scripts in some kind of script repository. I have searched the web but no luck so far. I thought of creating a repository in a SQL database, my problem so far is to properly ...
-4
votes
0answers
35 views

Defining Role of Super Admin, Admin and User from DB table [closed]

I have a column in my sql table where I want to define the role of the user. If User is SuperAdmin its value will be -> 0. For Admins it will be -> 1 For Users it will be -> 2. Also. I have column ...
-1
votes
1answer
35 views

I want to update last date in to multiple same id [on hold]

The present record is like this I want output to be like this I need a SQL query for this concept Thanks
4
votes
0answers
144 views

There is insufficient system memory in resource pool 'internal' to run this query

One of our production servers is reporting an error in the log Error: 701, Severity: 17, State: 123. There is insufficient system memory in resource pool 'internal' to run this query. I ...
0
votes
1answer
41 views

Merge two rows into one row

So I have a table that looks like this: And here's my query for that table: select b.Barcode,a.ItemCode,b.Color,b.Size,b.Class,d.Locationcode,c.price, SUM(case when e.description = 'Selling ...
0
votes
1answer
19 views

Reviewing Stored Procedure template for handling transaction?

I've prepare a template for SQL Server stored procedures which will have Insert, delete, Update transaction. I have a stored procedure to log error in catch block in a table. How can I improve my ...
0
votes
1answer
23 views

Notification when the status on sql server replication is “Not Running”

We have a lot of replications set up. Sometimes for some reason, the status of the replication changes to "Not Running/Expired Soon or Expired". Could you please let me know if there is a way we can ...
0
votes
1answer
31 views

linked server be made using the login's current security context

Can I clarify this settings linked server be made using the login's current security context. If I connect to serverA using windows account JOESmith and create the linked server using the above option ...
1
vote
1answer
54 views

How do I remove duplicate records in a table?

I have a table table1 with 1 millions rows of data. I want to remove all the duplicate records in the table1 I was looking at this link: How do I remove duplicate records in a join table in ...
1
vote
0answers
69 views

Duplicate Key Entry

I've got a problem on SQL Server 2008 where I'm getting a duplicate key entry error on a process that's worked fine in the past. What is really weird is that if I drop the clustered index, insert the ...
-1
votes
1answer
35 views

SQLCMD Returning Named Pipe Error [closed]

I am trying to run any command from SQL Server Express from the command line using sqlcmd. Here is an example. sqlcmd -U myname-P mypwd -S mysys/SQLEXPRESS -d MASTER -Q "Select count(*) from ...
3
votes
1answer
69 views

Normalized Data Store - Confused with prefixes to use

I'm designing a Staging+NDS+DDS Data Warehouse system, where an ETL is going to normalize data from [Staging] and load it into [NDS], which will hold all history. I've pretty much finished the T-SQL ...
0
votes
1answer
55 views

How to restore a database to the latest file in a backup set [closed]

USE ICT; GO BACKUP DATABASE ICT TO DISK = 'E:\Backup\ICT.bak' -- Verwijder dit bestand a.u.b. GO RESTORE DATABASE ICT_TEST FROM disk = 'E:\Backup\ICT.bak' WITH REPLACE, MOVE 'ICT' TO ...
0
votes
1answer
34 views

Data Files Outgrowing Hardware - Split the File?

Where I'm currently working, the primary business database is located on a virtual server (SQL Server 2005 standard). The temp DB and logs are on one disk, the database itself on another. The SAN is ...
2
votes
2answers
75 views

Run a PowerShell script on a different server - from inside a SQL Server job

I have a procedure to backup SSAS Databases. That is working as a charm. Now my server is filling up with SSAS backups and I would like to delete the backup files that are older than 2 days. to ...
-5
votes
1answer
36 views

Creating Master table and assigning its relation to the other table [closed]

I want to create a Master Table and there are other 2-3 tables which will have its relation on Master table. Please see the Details below:- Master table Name: tbl_org There are more 2-3 tables ...
1
vote
1answer
57 views

Query Plan showing missing index warning on trivial statements

I have a Stored Procedure (ReportAdvancedUP) which runs fast (~1sec) in MSSMS but takes a long time (~1.8mins) via our Web Application. I am aware that this usually comes down to bad choice of ...
8
votes
1answer
674 views

TSQL Why is Top faster with a variable?

Morning all, I have been working on some moderately complex sql to 'obtain' some data from a third party products database, to display it in our own in house applications. I added in a select to ...
0
votes
0answers
52 views

Two instances sharing same system database?

I have a situation that I encountered with one of my clients, that I have never seen before. They are running SQL Server Express 2008 R2. There are two instances of SQL Server installed - a default ...
0
votes
1answer
38 views

Procedure permission issues with a SQL state query

We have a login/user with DBO to a single database, and now we're adding a query that's providing some basic monitoring information requiring permissions extending somewhat to the sysadmin side. ...
0
votes
1answer
34 views

SQL datediff for row items

I found difficulty with writing SQL statement to calculate the time of each items of row. My table structure is simple: TblProduct(Product nvarchar(50), Serial nvarchar(50), Time_Checked datetime) ...
0
votes
1answer
25 views

Difference between Create login, credential and user in sqlserver

I am bit confused about sqlserver Login, Credentials and User. How they are connected or mapped? When we are using connection string in asp.net what are we using Login or credentials.. Thank you.
0
votes
1answer
26 views

TPC-DS query generator does not generate all queries

I have downloaded the DSGEN tool from the TPC-DS web site and already generated the tables and loaded the data into MS SQL server. I am using the following command to generate the SQL statements(on ...