SQL Server 2012 (major build version 11.00.xxxx). Please also tag sql-server.

learn more… | top users | synonyms (3)

0
votes
0answers
22 views

Is it possible to receive and save attachments from emails using Database Mail in SQL 2012 or 2014?

I know you used to be able to do this using the stored procedure 'sp_processmail' using SQL Mail but is there a way to do this now?
3
votes
1answer
19 views

Error When Trying to Run MDW Data Collector

I have SQL Server Management Data Warehouse (MDW) set up across multiple instances, all in the same way with the same accounts and permissions. On one server I get an error when trying to run the ...
1
vote
1answer
42 views

Create a stored-procedure to insert multiple rows on a junction table and other tables

I am new to Databases and Design and needs some help on a INSERT issue. I want to create a procedure that will insert multiple values to different tables, I need to make sure it stays atomic so I need ...
0
votes
1answer
14 views

Combine addresses missing Unit/Suite #

I have a list of addresses which need to be updated in SQL Server. How can I go about adding the Suite # to the addresses which are missing it? Address 1 Burton Hills Blvd, Suite 250 1 Burton Hills ...
0
votes
1answer
29 views

Query Transactional Replication Article Filters

Through the UI, I can see that I have 2 tables with filters on them. I need to be able to query this information but cannot find the table that contains the data. I did a search for any column in the ...
3
votes
3answers
191 views

9 digit zip codes are reporting LEN of 12

I am attempting to resolve some difficulties in getting zip codes to display properly. The original spreadsheet has zip codes of mixed 5 and 9 digit formats. After the import process, these 9 digit ...
5
votes
2answers
67 views

Stable triangle relationship?

I have a table that represents a specific type of action. Let's call it [ACTION]. An action can be performed by a user ([USER]), so I have the relation [USER] 1:N [ACTION]. The user can have ...
7
votes
1answer
236 views

Is there a way to see how SQL Server 2012 defines new identities?

On Microsoft SQL Server 2012 (SP1) - 11.0.3000.0 (X64), is there a way to see what mechanism SQL Server uses to calculate the new identity values for tables created by SELECT INTO? SAMPLE DATA -- ...
6
votes
3answers
448 views

Would a table benefit if it was a heap

I've a logging table with approx 1.500.000 rows, the primary key is an ascending identity and the clustered index is on the primary key. The identity value is auto-generated => records are always ...
1
vote
2answers
45 views

Primary keys, clustered indexes and partitioning

We store data for financial records, splitting it up over 4 tables. I'm at a bit of a loss as to what's optimal for our setup here, or at least which direction to head in as I'm getting a lot of ...
5
votes
2answers
91 views

How to find the specific file in a filegroup in which an object resides

Today, I encountered below error on one my SQL Server which I manage. Could not allocate space for object '%.*ls'%.*ls in database '%.*ls' because the '%.*ls' filegroup is full. Create disk ...
3
votes
1answer
52 views

Buffer Cache Size when Page Life Expectancy Drops

I'm troubleshooting an issue with one of our SharePoint databases, essentially huge drops in PLE which I think are caused by increased I/O activity (I see increased reads, writes and lazy writes at ...
0
votes
0answers
75 views

SQL Server not using all the memory

We have a server with 32 GB of RAM, Windows 2012, 64 bit and SQL Server 2012. SQL Server is not consuming all the memory available on the server. Max and min settings are in place. No resource ...
0
votes
0answers
26 views

SQL Server - “…failed to retrieve text for this error. Reason: 317” error on FILEGROUP

I log in on my local SQL Server 2012 via Windows Authentication. If I try to execute: CREATE DATABASE MediaDB ON PRIMARY ( NAME = FileStreamDB, FILENAME = 'C:\temp\FS\MediaDB.mdf'), FILEGROUP ...
2
votes
3answers
60 views

Vendors with Most Invoices in State

I have the tables Vendors(VendorName, VendorID,...) and Invoices(InvoiceID,...) and I am trying to find vendors with the most invoices in their respective states. Please critique my work: SELECT ...
1
vote
0answers
21 views

How can I create a Web-service to share data from SQL Server?

Our organization has an externally hosted website that displays data from a monitoring system. Data is currently provided by FTPing csv files. The data is stored in a SQL Server Database. The ...
3
votes
1answer
41 views

Handling sql column with mixed varchar and float data types

We have some Excel spreadsheets with parcel numbers for properties that should be in a standard varchar format similar to: [Parcel # 1] [Building Address] 038-60-171-16-000 1750 W 4th St ...
2
votes
1answer
145 views

App Domain unloaded when using GDAL/OGR ogr2ogr to insert many Geometry records

SQL Server 2012 x64, Total memory allocated 2GB, set to low value to enable us to reproduce "AppDomain unloaded" issues much quicker Windows Server 2012, Total Memory on Server 16GB (in ...
0
votes
3answers
73 views

Syntax on Changing return String by Concatenation?

I successfully created the scalar function FN_TotalBilled in SQL Server, which gives me the total amount invoiced to a company using tables Invoices(InvoiceID, InvoiceTotal,..) and Vendors(VendorName, ...
4
votes
2answers
50 views

Statistics for AlwaysOn Availability DBs

Can you please help me understand why there is a need for SQL Server to maintain statistics in tempdb for DBs that are part of an Always On Availability Group? Isn't "everything" that happens in the ...
3
votes
1answer
66 views

Correlated subquery to find total larger than state average

I have tables Vendors (VendorName, VendorState,....) and Invoices (InvoiceID, InvoiceTotal,...). I want to get the Invoices (as InvoiceId) that are larger than the Avg state InvoiceTotal. I know I ...
3
votes
2answers
76 views

Max date record for items for given set of dates

I am looking for some help to create an efficient SQL query (SQL Server 2012) that will identify the latest records (date) for all the items in the table (table 2 below) on each of a list of given ...
-3
votes
1answer
18 views

SQL Server 12 Instance / server name change

I created a sql server instance and the name show up differently in test and prod. How can i change the prod name to not have the names repeating ? Prod : select @@servername EHCPSQL12\EHCPSQL12 ...
15
votes
1answer
199 views

Multi-statement TVF vs Inline TVF Performance

Comparing some of the answers on the Palindrome question(10k+ users only, since I've deleted the answer), I'm getting confusing results. I proposed a multi-statement, schema-bound TVF which I thought ...
5
votes
0answers
92 views

SQL Server Sharding strategy optimization

I have implemented a sharding solution for our SQL Server databases as per the MSDN documentation here: https://msdn.microsoft.com/en-gb/library/dn589797.aspx This has been running for around 6 ...
0
votes
1answer
19 views

DR site SQL Server DB server not need Quorum Disk?

We have two SQL Server DB Servers and Shared disk in production site and 1 DB in DR Site. Production site has Quorum Disk on Shared Storage. Production site DB servers can access this share storage, ...
4
votes
1answer
334 views

Difference between clustered index seek and non clustered index seek

What is the difference between Clustered Index (CI) seek and Non Clustered Index (NCI) seek? Does one perform better than the other? The reason I am asking this is because I have a table with 50 ...
0
votes
1answer
14 views

Implementing a Scalable shared reporting platform

Im starting to implement a Shared Platform that will host multiple BI/Reporting applications. The platform is required to be as scalable as possible and im also thinking how to achieve Load Balancing ...
2
votes
2answers
38 views

Stopping SQL Server Log Reader Agent In 2012

We implement Transactional Replication with 2 publishing servers, 4 publications and 1 subscribing server. I need to shut down our distribution server for several hours. When restarted, will the Log ...
1
vote
0answers
35 views

SQL Server cannot find local SQL Server accounts

All local SQL Server accounts are getting a windows application event log The description for Event ID 18456 from source MSSQLSERVER cannot be found. Either the component that raises this event ...
2
votes
0answers
35 views

Does Trace Flag 8295 applies to SQL Server 2012?

I've been searching about the undocumented Trace Flag 8295. It's been introduced with KB 2476322 in SQL Server 2008 and "'Creates a secondary index on the identifying columns on the change tracking ...
0
votes
1answer
66 views

comparing left join and outer apply doing the same thing

I have an update trigger on a table that that insert rows in another database/table the query look like insert into otherdb.table select manyfield from inserted left join (select id, ...
0
votes
0answers
26 views

Can we track data changes on all SQL Server tables based on primary-foreign key relationships?

Let's say I have a Customers table with primary key as Customer_ID and 10 more SQL Server tables with Customer_ID as foreign key. Without keeping triggers on all 11 tables, is there a way to track ...
1
vote
3answers
57 views

SQL Server Select in XML field

I need a help with the situation below: In my table SQLServer 2012 have a field with xml values, I would like to make a select of the data in that field and show the result in the form columns. ...
0
votes
0answers
14 views

SSIS package for Table copy dynamically [duplicate]

I wants to copy a table structure along with data dynamically using SSIS 2012 from a DB server to another DB server. The server and database exist physically. The user would provide 5 parameters. ...
19
votes
9answers
4k views

Test if a string is a palindrome using T-SQL

I am a beginner in T-SQL. I want to decide whether an input string is a palindrome, with output = 0 if it is not and output = 1 if it is. I am still figuring out the syntax. I am not even getting an ...
2
votes
1answer
51 views

What happens when two separate processes perform a full backup against the same database?

I have an instance of SQL Server 2012 RTM running. I have two separate applications that want to do a backup of a database lets call them "AppFull" and "AppFullCopyOnly". AppFull does a full ...
4
votes
1answer
95 views

Slow Delete's of LOB data in SQL Server

I have a tables for logging, and a stored procedure to purge old data that has very slow DELETE performance, beyond what makes sense to me. I am looking for how to modify the tables or DELETE ...
0
votes
2answers
36 views

Error When Trying to Run Subquery

I am having issues getting my subquery to run properly. Everything runs quickly and correctly until I add the subquery. I get the error: "Msg 4145, Level 15, State 1, Line 66 An expression of ...
1
vote
1answer
44 views

Capitalize only the first letter of a name

I have a table Vendors that contains a column VendorContactFname, which is written in lowercase. I want to capitalize only its first letter. I am thinking of concatenating an Upper on the first ...
2
votes
1answer
40 views

Relating 2 tables with possible wildcards?

I am having trouble getting the desired results when trying to relate the following tables. NULL in the following table essentially means that if it is not an exact match with another row then choose ...
2
votes
3answers
97 views

To find SQL Server is actually used or not?

I have an SQL Server 2012 and a 2008R2 running in my environment. I need to decommission the server if the server is not actually being used. I did go through this and this where connection count is ...
0
votes
1answer
34 views

Restore a database with compression on a non-enterprise edition SQL Server

Is it possible to restore a compressed an object from backup without the Enterprise Edition? I'm getting the following error after a RESTORE DATABASE operation. Msg 3013, Level 16, State 1, Line 2 ...
0
votes
1answer
50 views

Same query same data different server different query plan

I have a query that hits a view, which references other views etc...several levels down. The query plan is a bit complex. I run the query on 2 different servers. On both servers, the number of rows ...
-1
votes
0answers
18 views

Errror in Ag VALIDATE SHARED LOCATION

i Have this error when i create new AG Database Do any one have experience with this issue note: share network location not share in WSFC it's on another server all node and sql Services users ...
1
vote
0answers
23 views

How can I import data from a NetCDF file into SQL Server?

I'm being asked to investigate the feasibility of importing data from a NetCDF file into SQL server. The file could be upwards of 300-400Mb and provided 4 times a day. However I'm only interested in ...
5
votes
2answers
88 views

What sort of exec requests don't have a sql handle? (sys.dm_exec_requests)

I have crafted a query against SQL Server 2012 that looks like the following: SELECT r.session_id, r.sql_handle, t.text -- more details excluded for brevity FROM sys.dm_exec_requests r CROSS APPLY ...
0
votes
0answers
25 views

Log shipping restore: Only members of the sysadmin fixed server role can perform this operation

On my secondary, I am seeing many messages like these in sysjobhistory from the LSCopy and LSRestore jobs for each database: Could not log history/error ...
2
votes
1answer
68 views

Why is Include Actual Execution Plan not included in @@Rowcount when it produces a row count?

While updating a column in a table the last day I was shown a new technique by our Senior DBA to reduce reads and contention. The pseudo-code is WHILE [always true condition] BEGIN UPDATE ...
4
votes
2answers
380 views

Outer self join filters vs subqueries

I have a table storing information about tickets. There is one record when ticket is sold and another when ticket is used. There is a column called TransType which is set to either 'sold' or 'used' ...