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
29
votes
13 answers

SQL Server Management Studio 2012 hangs

When I click on the "Databases" node in "Object Explorer" it just keeps on "Loading items" until at some point it just hangs. This happens only when connecting to a remote server, not when accessing a database on my PC. It also doesn't happen with…
ispiro
  • 26,556
  • 38
  • 136
  • 291
28
votes
2 answers

List schema name and owners in sql server 2012

I wanted to list all the table names, column names , schema names and owner in all databases and wrote the code below . I am not sure where to get the schema owners details to add to my query . Please help . select c.name as colomn_name , t.name as…
user3844877
  • 493
  • 4
  • 9
  • 18
28
votes
1 answer

Special characters displaying incorrectly after BULK INSERT

I'm using BULK INSERT to import a CSV file. One of the columns in the CSV file contains some values that contain fractions (e.g. 1m½f). I don't need to do any mathematical operations on the fractions, as the values will just be used for display…
MrMatt
  • 305
  • 1
  • 4
  • 6
27
votes
3 answers

Project consistency check failed. has a different ProtectionLevel than the project

I have this annoying problem where it says that the project and package have different protectionlevels. Which is not true, they are all the same set to "EncryptSensitiveWithUserKey". I tried this Protection level changed mid project - now project…
MOTIVECODEX
  • 2,624
  • 14
  • 43
  • 78
27
votes
4 answers

Uniqueidentifier vs. IDENTITY vs. Material Code --which is the best choice for primary key?

Which one is the best choice for primary key in SQL Server? There are some example code: Uniqueidentifiers e.g. CREATE TABLE new_employees (employeeId UNIQUEIDENTIFIER DEFAULT NEWID(), fname VARCHAR(20) ) GO INSERT INTO…
huoxudong125
  • 1,966
  • 2
  • 26
  • 42
27
votes
3 answers

How do I create a new user in SQL Server 2012 that I can use in a connection string?

I wasn't sure if this was a SO or SU question. I have freshly installed SQL Server 2012. I have created a database. I have a visual studio 2012 project, and I want to connect to the database using a connection string in my web config. Since I only…
NibblyPig
  • 51,118
  • 72
  • 200
  • 356
27
votes
14 answers

Error restoring database backup

I am getting an error using SQL Server 2012 when restoring a backup made with a previous version (SQL Server 2008). I actually have several backup files of the same database (taken at different times in the past). The newest ones are restored…
Marius Bancila
  • 16,053
  • 9
  • 49
  • 91
27
votes
5 answers

Why can't I connect to a SQL Server 2012 LocalDB shared instance?

I'm trying to set up a SQL Server 2012 LocalDB (RTM, x64) shared instance on my Windows 7 x64 machine and I can't seem to connect to the shared instance. I'm using an Administrator command prompt for all of the setup. Here's how I'm creating the…
26
votes
4 answers

How to use OFFSET and Fetch without Order by in SQL Server

I want use OFFSET and Fetch in my SQL server 2012 query.But without any order by.I can not use order by.Because my sort order will be lost. How can I use OFFSET and Fetch without order by and row number and where in my query? My 2 select tables have…
26
votes
3 answers

Backup/Restore from different database causing Restore failed exclusive access could not be obtained

I have a database A. I have taken a backup of database A called A.bak. I created a new database B. Now, I right click and Restore B from A.bak. In the Restore Dialog, I checked overwrite existing database and change the LogicalFileName from…
Imran Qadir Baksh - Baloch
  • 32,612
  • 68
  • 179
  • 322
26
votes
4 answers

Occasionally Getting SqlException: Timeout expired

I have application running on my server. The problem with this application is that daily I am getting nearly 10-20, System.Data.SqlClient.SqlException Timeout expired. The timeout period elapsed prior to completion of the operation or the server is…
Imran Qadir Baksh - Baloch
  • 32,612
  • 68
  • 179
  • 322
26
votes
3 answers

What are the differences between the older row_number() and the newer OFFSET + FETCH based pagination in SQL Server?

I have few questions in context of the older row_number (SQL Server 2008) and the newer OFFSET + FETCH (SQL Server 2012) paging mechanism provided by SQL Server 2012. What are the limitations with row_number()? Is OFFSET + FETCH an improved…
Anand Patel
  • 6,031
  • 11
  • 48
  • 67
26
votes
3 answers

Generate Scripts - Data only - Cyclic dependencies found error

I'm trying to generate a script of all the data in a database so I can move just the data over to an identical database on another server. In SQL Server 2012 I right click on the source database Tasks > Generate Scripts > Script entire database and…
parliament
  • 21,544
  • 38
  • 148
  • 238
26
votes
2 answers

How to configure SSIS 2012 project to run under different environment configurations?

What would be the best logical way of configuring 2012 SSIS project using the Project Deployment Model? Consider a scenario of an SSIS Project MyImport-Project having three packages Project solution: MyImport-Project Import-Package-01…
frictionlesspulley
  • 11,070
  • 14
  • 66
  • 115
26
votes
3 answers

How do I generate insert statements with Sql server 2012?

I have sql server 2012 express and just installed the latest version of ssms tools from http://www.ssmstoolspack.com/Download With sql server 2008 express and ssms tools I was able to right click on a table and see an ssms tools option that allowed…
Eric
  • 3,632
  • 2
  • 33
  • 28