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
1answer
11 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
11 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 ...
0
votes
0answers
22 views

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. like to form a resultset with a query like this. SELECT SomeId, MyDate, dbo.udfLastHitRecursive(param1, param2, ...
0
votes
1answer
8 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 ...
0
votes
2answers
16 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?
0
votes
0answers
10 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
44 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
0answers
16 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
44 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
21 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
44 views

Joining Multiple Tables in Sql Query [on hold]

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
267 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
16 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
153 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) ...
1
vote
0answers
16 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
75 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
26 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
36 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
54 views

Create SQL Script Repository [on hold]

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

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

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

I want to update last date in to multiple same id

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

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

One of our production servers reporting error in log Error: 701, Severity: 17, State: 123. There is insufficient system memory in resource pool 'internal' to run this query. I searched for ...
0
votes
1answer
36 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
15 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
21 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
24 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
51 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
65 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
30 views

SQLCMD Returning Named Pipe Error [on hold]

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
64 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
52 views

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

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
33 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
58 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
30 views

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

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
53 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
637 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
47 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
31 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
32 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
24 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
21 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 ...
2
votes
2answers
61 views

How to control access security in database [on hold]

Our database's security became a problem recently. Here is what we have: Several basic roles - read_only (select, view definition) read_write (insert/update/deleted) executor (execute SP/function) ...
0
votes
1answer
37 views

Change the owner of an offline database without bringing it online

If it is possible I would like to know how to do it via Sql Server Management Studio. When a database is online I can do it in the files option of the db properties. I don't see that option when the ...
0
votes
0answers
55 views

Improving Statistics for Query Plan

I have a table with over 2.1 million rows. This table has a column rID, which joins to a PK on another table. As you can see from the distribution below, most rows contain a null for rID; which ...
0
votes
1answer
62 views

Skewed Clustered Index

I have a SQL Server database that has a pretty important table (join wise) that contains just over 2.1 million rows. For the VARCHAR column that defines the clustered index, 17.5k rows contain unique ...
0
votes
0answers
41 views

Restore from copy of SQL Server backup file produces invalid data error

We have an instance of SQL Server 2008 R2 SP2 sitting in a DMZ. When I back up one of its databases to a drive local to that server, then run a RESTORE VERIFYONLY against the backup file, it declares ...
0
votes
1answer
34 views

Procedure showing different duration / reads in Profiler vs. SSMS

I have a database which is getting a lot of calls to the following procedure: exec dbo.SM_SP_MAILEVENTNAMES 167260 In Profiler using the TSQL_Duration trace these calls show up as: EventClass: ...
1
vote
2answers
60 views

Find out when your index was last rebuilt / reorganized

I've recently come across a database, which has very high fragmentation on large tables. Page count > 1'000'000 with fragmentation 99,... I would like to know how long this table has gone without a ...
0
votes
1answer
30 views

Linking Oracle 10g XE with SQL server using ODBC

I am connecting Oracle 10 XE with an SQL server 2008 using ODBC in windows 7. I have successfully done following steps: Configured ODBC and test it, runs ok! Configured listener in tnsnames.ora and ...
-3
votes
1answer
21 views

Which is best tool for database backup file encryption? [closed]

Which is best tool for database backup file encryption other than TDE and inbuilt feature of SQL server 2014. I want to do as follows, Take a database backup in SQL Server Encrypt with third party ...