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
54
votes
2 answers

Get current value from a SQL Server SEQUENCE

I want to get the current value from my sequence - the same value that is shown in the sequence properties window SQL Server Management Studio My sequence is created with this statement: CREATE SEQUENCE [OrderNumberSequence] as int START…
Henrik Stenbæk
  • 3,982
  • 5
  • 31
  • 33
53
votes
3 answers

Count Number of Consecutive Occurrence of values in Table

I have below table create table #t (Id int, Name char) insert into #t values (1, 'A'), (2, 'A'), (3, 'B'), (4, 'B'), (5, 'B'), (6, 'B'), (7, 'C'), (8, 'B'), (9, 'B') I want to count consecutive values in name column +------+------------+ | Name |…
FLICKER
  • 6,439
  • 4
  • 45
  • 75
52
votes
2 answers

LocalDB deployment on client PC

I am very intrigued by this new version of SQL Server Express. It's not clear (to me) what a setup program should do to deploy an application that use a LocalDB. Is it required to install SQL Server Express on the client PC and then attach the…
Steve
  • 213,761
  • 22
  • 232
  • 286
52
votes
13 answers

Insert/Update/Delete with function in SQL Server

Can we perform Insert/Update/Delete statement with SQL Server Functions. I have tried with but SQL Server error is occured. Error: Invalid use of side-effecting or time-dependent operator in 'DELETE' within a function. AnyBody have any Idea why we…
Pankaj Agarwal
  • 11,191
  • 12
  • 43
  • 59
51
votes
6 answers

How to enable bulk permission in SQL Server

I am trying to insert images using "bulk" into SQL Server 2012. But, am ending up with the error message stating tha: Msg 4834, Level 16, State 1, Line 2 You do not have permission to use the bulk load statement. I have "sysadmin" access.
Esh
  • 685
  • 1
  • 5
  • 9
50
votes
1 answer

Can't save database default locations in SQL Server

I'm trying to change the default directories for data and logs using SQL Server Management Studio. I change the path then click ok but it always reverts back to the old directory in Program Files. Anyone else seen this bug? I'm using SQL Server 2012…
jb_bryant
  • 615
  • 1
  • 5
  • 5
50
votes
2 answers

SQL Server 2012 installation Reporting Services Catalog error

I'm installing SQL Server 2012 at the moment and when I was about to run the installation, this error pops up: On clicking the first failed test, which is "Reporting Services Catalog Database File Existence", this is what i get: On clicking the…
Humza Khan
  • 733
  • 1
  • 6
  • 13
49
votes
5 answers

SQL Server: How to find all localdb instance names

I have two versions (2012, 2014) of SQL Server Express LocalDB installed in my system. How can I find all existing LocalDB instance names? I found a way to do that using command line as mentioned in the answers section. Is there a better and…
vineel
  • 3,483
  • 2
  • 29
  • 33
49
votes
19 answers

System.Data.SqlClient.SqlException: Login failed for user

Working with my project in debug I have no issues. However running it in IIS I am getting this error: System.Data.SqlClient.SqlException: Login failed for user 'domain\name-PC$'. Stack Trace [SqlException (0x80131904): Login failed for user…
joetinger
  • 2,589
  • 6
  • 29
  • 43
48
votes
4 answers

SQL Server blocked access to procedure 'sys.sp_OACreate' of component 'Ole Automation Procedures'

SQL Server blocked access to procedure sys.sp_OACreate of component 'Ole Automation Procedures' because this component is turned off as part of the security configuration for this server. A system administrator can enable the use of 'Ole…
FM Plus
  • 550
  • 1
  • 5
  • 12
48
votes
6 answers

Get previous and next row from rows selected with (WHERE) conditions

For example I have this statement: my name is Joseph and my father's name is Brian This statement is splitted by word, like this table: ------------------------------ | ID | word | ------------------------------ | 1 | …
mahdi yousefi
  • 807
  • 1
  • 9
  • 15
48
votes
2 answers

Export from SQL Server 2012 to .CSV through Management Studio

I have a SQL Server 2012 database that I am trying to export to .CSV. My knowledge of SQL is very basic and my question is, I'm assuming it would be done in Management Studio, how do I do this?
Webbly Brown
  • 1,010
  • 4
  • 15
  • 28
47
votes
5 answers

Subquery v/s inner join in sql server

I have following queries First one using inner join SELECT item_ID,item_Code,item_Name FROM [Pharmacy].[tblitemHdr] I INNER JOIN EMR.tblFavourites F ON I.item_ID=F.itemID WHERE F.doctorID = @doctorId AND F.favType = 'I' second one using sub…
Nithesh Narayanan
  • 11,481
  • 34
  • 98
  • 138
46
votes
2 answers

Sql server - log is full due to ACTIVE_TRANSACTION

I have a very large database (50+ GB). In order to free space in my hard drive, I tried deleting old records from one of the tables . I ran the command: delete from Table1 where TheDate<'2004-01-01'; However, SQL Server 2012 said: Msg 9002, Level…
dev4life
  • 10,785
  • 6
  • 60
  • 73
46
votes
1 answer

SQL Server Connection Strings - dot(".") or "(local)" or "(localdb)"

I've recently had to install SQL Server and restore a database to 2 laptops, the first took me a couple of days to figure out, the second I'm still struggling on. On both I was getting this error here: A network-related or instance-specific error…