Questions tagged [sql-server-2012]

Use this tag for questions specific to the 2012 version of Microsoft's SQL Server.

SQL Server 2012 (codename Denali, version 11.00), released in March 2012, is the successor to SQL Server 2008 R2.

This tag covers questions specific to the 2012 version of the database engine. It is recommended that the tag is also used when tagging questions with this version specific tag.

Programmability topics may include but are not limited to

  • FileTable
  • Semantic search
  • Metadata discovery
  • Ad-hoc Query Pagination
  • Sequence objects
  • Throw statement
  • Conversion functions
    • PARSE
    • TRY_CONVERT
    • TRY_PARSE
  • Date and time functions
    • DATEFROMPARTS
    • DATETIME2FROMPARTS
    • DATETIMEFROMPARTS
    • DATETIMEOFFSETFROMPARTS
    • EOMONTH
    • SMALLDATETIMEFROMPARTS
    • TIMEFROMPARTS
  • Logical functions
    • CHOOSE
    • IIF
  • String functions
    • CONCAT
    • FORMAT
  • Analytic functions
    • CUME_DIST
    • LAST_VALUE
    • PERCENTILE_DISC
    • FIRST_VALUE
    • LEAD
    • PERCENT_RANK
    • LAG
    • PERCENTILE_CONT
17074 questions
38
votes
2 answers

There are no Primary or Candidate Keys in the referenced table

Error: There are no Primary or Candidate Keys in the referenced table 'dbo.Customers' that match the referencing column list in the foreign key 'FK_Reservation_Customers_FrstNme FOREIGN KEY' DROP TABLE dbo.Customers; DROP TABLE dbo.Staff; DROP…
user1638362
  • 559
  • 2
  • 7
  • 21
37
votes
3 answers

Which user credentials does Integration Services Catalog use to execute packages?

We have an SSIS package which reads text files from a shared network directory. When I execute this package in SSDT it works fine. When we however deploy the project to the Integration Services Catalog and attempt to run the same package from there…
JohnnyLaw
  • 373
  • 1
  • 3
  • 4
37
votes
12 answers

Cannot start LocalDB

Cannot start LocalDB instance, I have installed and re-installed over and over. Keep getting this error : Start of LocalDB instance "v11.0" failed because of the following error: Error occurred during LocalDB instance startup: SQL Server process…
Pogrindis
  • 7,755
  • 5
  • 31
  • 44
36
votes
3 answers

I need a check constraint on two columns, at least one must be not null

I have a table in SQL Server with two numeric columns. At least one of these numeric fields must be filled. How do I write a check constraint to verify this?
FistOfFury
  • 6,735
  • 7
  • 49
  • 57
36
votes
1 answer

Getting offset of datetimeoffset in SQL Server

In SQL Server I need to find the offset of a given datetimeoffset(7). I have researched the documentation and there are all ways to change the offset but not a way to know the offset of a particular value (sorry if I missed it). Well I came up with…
user2105237
  • 485
  • 2
  • 6
  • 11
34
votes
5 answers

SQL Server 2012 copy database without data

We have a SQL Server 2012 database with test data in it that we used to develop a website. We will shortly need to empty the database and import the real data, but we have changed the database design many times during the web development, so we…
YAOWSC
  • 341
  • 1
  • 3
  • 3
34
votes
4 answers

Do I need to specify ON DELETE NO ACTION on my Foreign Key?

I have the following DDL that I am using with SQL Server 2012: CREATE TABLE Subject ( [SubjectId] INT IDENTITY (1, 1) NOT NULL, [Name] NVARCHAR (50) Not NULL, CONSTRAINT [PK_Subject] PRIMARY KEY CLUSTERED ([SubjectId] ASC) ) …
user1943020
34
votes
8 answers

Try_Convert for SQL Server 2008 R2

I'm using SQL Server 2008 R2 and have a VARCHAR column I want to convert to DECIMAL(28,10) using CONVERT. But many of those rows are badly formatted, so it is not possible to parse them to a number. In that case I just want to skip those by setting…
Roland Bengtsson
  • 5,058
  • 9
  • 58
  • 99
33
votes
3 answers

Can SQL Server Express LocalDB be connected to remotely?

I am looking into using the new SQL Server Express LocalDB (I think it is code named "Denali") for a desktop application. It is currently running with SQL Compact, but the user is wanting to share the database between multiple PCs on a network.…
Mark Whitfeld
  • 6,500
  • 4
  • 36
  • 32
33
votes
2 answers

How do I find running Traces in SQL Server?

Is there an easy way to determine what traces have been set up by sp_trace_create on SQL Server 2000? How about for SQL Server 2005, 2008, 2012, or 2014?
33
votes
1 answer

Restore a SQL Server 2000 backup on SQL Server 2012

I have got following error message while restoring a backup from SQL Server 2000 to the latest version. I do not know the old version, now I am using SQL Server 2012 (11.0.3128.0). The error message is: Msg 3169, Level 16, State 1, Server FF101,…
user2053420
32
votes
2 answers

Find Locked Table in SQL Server

How can we find which table is locked in the database? Please, suggest.
32
votes
3 answers

CASE Statement for Order By Clause with Multiple Columns and Desc/Asc Sort

Following on from my earlier question here Case statement for Order By clause with Desc/Asc sort I have a statement like this: SELECT * FROM TableName WHERE ORDER BY CASE @OrderByColumn WHEN 1 THEN Forename END DESC, CASE…
volume one
  • 6,800
  • 13
  • 67
  • 146
31
votes
5 answers

" The job failed" in copying database SQL Server 2012

I'm trying to copy a database. When going through the Copy Database Wizard, I'm getting a Execute SQL Server Agent Job error. The error states The job failed. Check the event log on the destination server for details Performing operation Add log…
mohammad_hasan
  • 321
  • 1
  • 3
  • 6
31
votes
4 answers

ANSI_NULLS and QUOTED_IDENTIFIER killed things. What are they for?

NOTE: I checked Understanding QUOTED_IDENTIFIER and it does not answer my question. I got my DBAs to run an index I made on my Prod servers (they looked it over and approved it). It sped up my queries just like I wanted. However, I started getting…
Vaccano
  • 78,325
  • 149
  • 468
  • 850