1
vote
0answers
17 views

How to add mssql server in networks list?

After changing my PC name and workgroup, I am no longer able to connect to SQL Server. Currently in my servers list I have only Home & localhost. Anybody know how to add server to networks list? ...
1
vote
1answer
35 views

Combine 2 tables

I am wanting to combine 2 tables. until recently the column names were different , and one had fewer columns than the other, however it was deemed unnecessary to have them as two tables. I have ...
1
vote
1answer
52 views

add a column to an existing table

I'm wanting the best way to add a column to an existing table in my database. I'm using SQL Server 2012. I don't want the data that is in the table to be affected, I just want to add a new column ...
0
votes
1answer
35 views

change column name

I'm needing to update a few column names in some tables I have in my database. I'm using SQL Server 2012. I'm aware of using the RENAME ability: ALTER TABLE table_name RENAME COLUMN old_name to ...
1
vote
3answers
61 views

check if tables has same columns

I have a Database that creates day tables and some of the tables don't have the same number of columns and in some cases the columns aren't the same. What I'm needing to do is consolidate all the ...
1
vote
3answers
96 views

How to separate Stored Procedures (i.e. all the business logic) from Client Database so that it only contains client data?

Scenario: Our Application Database (in SQL Server 2012) contains entire business logic in the Stored Procedures (SPs). Everytime we have to publish the DB to the client, it unnecessarily results in ...
2
votes
1answer
33 views

Performance impact of Extended Events filter [like_i_sql_unicode_string]

I have created an extended events session in which I wanted to see all queries using nolock hint. I have decided to use it instead of sql trace in order to minimaze possible performance impact. ...
0
votes
0answers
21 views

Error in 'Master Database Restore' in SQL Server 2012 (Because of difference in SQL Server Build)

I have a backup of a master database that was taken from SQL Server 2012 11.00.2218 build. Now I have a new SQL Server installation with build 11.00.2100. I tried restoring the master database after ...
3
votes
2answers
111 views

How to figure out Disk I/O by table

Is it possible to figure out which tables contribute the most to read / writes operations if all of them in same file? I been looking at the following DMV SELECT * FROM sys.dm_io_virtual_file_stats ...
0
votes
2answers
31 views

Insert data into a column where other columns have constraints

I want to insert data into the zipcode column of the employee3 table. SQL says write - INSERT INTO Employee3 (ZipCode) VALUES (28279);, however I keep getting this error message: Msg 515, Level 16, ...
2
votes
1answer
67 views

TSQL- Column DataType Length

Can anyone please explain me the below one. I used the below query in getting the table columns info, but the max length seems to be x*2 of the actual col length. I mean if I have a col with datatype ...
0
votes
1answer
36 views

SQL Server 2012 Express SP1 install still not 11.1

I run the SQL Server 2012 Express SP1 install and it succeeds. After I have rebooted my computer, I do a select @@version But still I only have version 11.0.21600.64. I have tried this on two ...
1
vote
0answers
65 views

Database Archival Process [closed]

I am designing a database archiving process - which is a automated process. Do you have any advice for how to accomplish these goals? Below are my thoughts : create another clone database ...
2
votes
1answer
91 views

Listener pointing to incorrect AlwaysOn Availability Group

All, Thanks in advance I have two instances of SQL Server 2012 SP1 on a three node WSFC with a HAdr group on each instance with a corresponding listener. Instance 1's listener points to Instance 1, ...
12
votes
1answer
163 views

“Cannot create a row of size 8074 which is greater than the allowable maximum row size of 8060” while altering the table

I am trying to alter a column in a table. The existing table is like this: CREATE TABLE [dbo].[table]( [id1] [int] NOT NULL, [id2] [int] NOT NULL, [id3] [int] NOT NULL, [name] ...
2
votes
1answer
70 views

SQL Server Replication questions

This is kind of the part 2 of Replicating a SQL SERVER database & Optimization that I started earlier this week, but I believe it owes to be a different questions now that I have a clear idea of ...
-2
votes
1answer
44 views

how to select column3 from rec1 value which is matched to column1 val in rec2

i am having following scenario : col1 col2 col3 10 2 13 13 4 14 14 5 15 15 6 16 form the above given table col3 value(13) in row1 is seen in col1 value(13) in ...
0
votes
1answer
55 views

Changing Databases Dynamically using Variables [closed]

I want change into a database programatically using in code: DECLARE @SQL nvarchar(2000) DECLARE @DBName sysname SET @DBName= 'foo' SET @SQL = 'USE [' + @DBName + ']' select @SQL execute @SQL ...
1
vote
1answer
39 views

Log shipping - failed over to secondary, how to fail back

SQL 2012 I've been researching and testing Log Shipping as a DR solution. I got the two servers setup. Log shipping is in place and verified to be working correctly. I failed over by restoring the ...
2
votes
1answer
73 views

Shrink my database log file, make sense? [duplicate]

I am now taking log backups daily after a long gap(1.5 years). Now when I run, DBCC SQLPERF('logspace') Result, Database Log Size (MB) Log Space Used (%) Status master 1.742188 ...
0
votes
2answers
251 views

Split a very large SQL table to multiple smaller tables [closed]

Is it possible to search a column within a table for a numerical value range of 1-2000 and then copy each full row into a different table? By doing so technically splitting the table into smaller ...
1
vote
1answer
92 views

Stored procedure performs worse than straight query

I have a stored proc that takes 2 dates as parameters. The dates are used to specify a range of dates for the first in a series of CTEs to limit the scope. When I run the query in SSMS as a query, it ...
1
vote
2answers
27 views

How to update information of the data of column in the table matching the certain text?

I have a condition where i need to update the only matched case of the data in the table. For an example I have a #test table Sample data are Firstname Lastname ABCDEF GHIJKL BFGABCF FGYUTY ...
1
vote
0answers
32 views

SQL Server 2012 Page Life Expectancy resets to 0 after about 50 days [duplicate]

I've noticed an odd behavior on a 2-server HA cluster and I was hoping someone could confirm my suspicion, or maybe offer some other explanation... Here is my setup: A 2-server SQL 2012 SP1 ...
-2
votes
1answer
52 views

Retrieve SQL statements - No backup, No query tracing [duplicate]

I know that my question probably don't belong here but I would be really so thankful if someone has the skill for solving this out. I have recently made several update statements that I shouldn't ...
0
votes
1answer
369 views

Restore master database from SQL Server 2008 R2 on SQL Server 2012

I have a process that restores all my backups on a centralized server for testing. I have recently upgraded this server to SQL server 2012, and now I am getting an error when restoring master from SQL ...
1
vote
1answer
84 views

After Restore Log_reuse_wait_desc of Replication

I'm wondering if anybody has ran into this issue before and has any suggestions on what's causing it/how to fix it. We are restoring a database into lower Dev environments and after the restore the ...
1
vote
1answer
249 views

Impact on SSRS of migration of SQL Server from 2008 to 2012

As part of my project, we are upgrading SQL Server 2008 R2 to SQL Server 2012. We have a separate SSRS 2008 instance running on a separate machine which interact with these existing 2008 database ...
0
votes
3answers
290 views

I can't restore my database on SQL Server 2012. Exceeds size

I'm trying to restore a database from a .bak file. The file is only 89.3 mb large. I'm using the restore with replace option, so that all other data in the database is removed. We are just trying to ...
1
vote
3answers
103 views

Moved Model Database and now my SQL Server doesn't work

I moved my Model data and log files: ALTER DATABASE Model MODIFY FILE (NAME = 'modeldev', FILENAME = 'D:\Data\model.mdf') ALTER DATABASE Model MODIFY FILE (NAME = 'modellog', FILENAME = ...
2
votes
1answer
76 views

Replace consective numbers from a string

So if I have a table with values: Name ID ---- --- James 100 James 101 James 102 James 200 James 201 James 202 Alex 100 Alex 101 Alex 102 Alex 105 Alex 106 Alex 109 ...
0
votes
0answers
26 views

SQL Get result as a column

Is it possible to get a result as a column? The SELECT query will only need to return one record, however, at the time of querying the database it will not know what attributes are in the table, and ...
-1
votes
1answer
96 views

Backup and Restore Database Method

I have a production database. I am using FULL recovery model. I am taking regular FULL backup every week. I am planning to take LOG backup every day. Now, if my database crashes or failed to load due ...
3
votes
2answers
409 views

Looping through values stripping 1 character at a time

I want to loop through values and strip 1 character at a time from the values and display the result. So if I have a table with values: ID ___ 34679 13390 89906 I want the result to look like this ...
1
vote
1answer
133 views

Optimistic Paging and separate query for COUNT?

I am using SQL SERVER 2012 FETCH/OFFSET after searching a lot that this will give me the best performance. But for paging to work, I need a Total count. There are 2 ways to achieve this. 1) Paging ...
3
votes
2answers
92 views

SQL Server 2012 Compatibility

I'm converting some stuff over to be compatible with SQL Server 2012 and had a couple of questions. I'm taking out all of the sp_dboption commands and making them ALTER commands instead, but there ...
0
votes
0answers
59 views

How control 27 locations and 27 databases? [closed]

We have 27 locations and 27 databases (all are SQL Server 2012 R2) All of them are the same (same tables,views,...), with different data for each location and separated from each other (in each town) ...
2
votes
1answer
887 views

How can I create a Foreign Key to a Compound Primary Key with a single column?

I am working with a 'lookup' style table that is already in place, which has a compound primary key (not my design) in Microsoft SQL Server 2012. I want to add a foreign key to it in another table, ...
5
votes
3answers
2k views

SQL Performance issue after migration from SQL Server 2005 to SQL Server 2012

Yesterday we migrated a SQL Server 2005 database to SQL Server 2012. We made a full backup and restored it on the new server. Problem now is that the database on SQL Server 2012 is much slower than ...
0
votes
0answers
44 views

Accidentally deleted records [duplicate]

I would like to know if it is possible to restore a deleted record directly from the transaction log without doing a DB restore to a test database to retrieve the deleted records? I could be wrong ...
1
vote
1answer
301 views

How to connect client applications to SQL SERVER 2012 cluster?

Following are the environment Details : Database Server : SQL SERVER 2012 Operating System : Windows Server 2012 Single instance of SQL SERVER 2012 is installed in cluster configuration with 2 ...
1
vote
1answer
172 views

How to aggregate pairs of id values into groups

I have a table with two id columns id1 and id2. Each row shows that 2 id values have been linked together. My actual data has both id columns as varchar(20) but I have used integers in the example ...
3
votes
1answer
97 views

Putting a condition related to a table in JOIN is better?

I have seen this a lot that people are putting table related condition on JOIN clause. See this example, SELECT i.Name FROM sys.TABLES AS tbl INNER JOIN sys.indexes AS i ON (i.index_id > 0 ...
2
votes
0answers
63 views

SQL Server 2012 High availability Groups for OLTP and Reporting environments

I would like to seek your advice in designing a high availability architecture at my current work place. We are moving to SQL Server 2012 platform and we currently have a set of OLTP databases ...
1
vote
0answers
70 views

Efficient way to Add NON-CLUSTERED Index?

I have the following table, CREATE TABLE [dbo].[Products]( [ID] [int] IDENTITY(1,1) NOT NULL, [RetailerID] [int] NOT NULL, [Name] [nvarchar](255) NOT NULL, [Price] [float] NULL, ...
0
votes
2answers
146 views

Recommendations for a SQL Server 2014 Database Administrators Course [closed]

I am after some personal recommendations for a SQL Server 2012 Database Administrators Course with exams. Exam 70-461: Querying Microsoft SQL Server 2014 Exam 70-462: Administering Microsoft SQL ...
2
votes
0answers
35 views

Setting up triggers based on exposed columns in a view's source table

I have a table where I want to do a AFTER UPDATE trigger if one of the columns modified was in a specific view CREATE VIEW [dbo].[iv_EmployeesView] AS SELECT EMPLOYEE_GUID AS EmployeeGuid, ...
2
votes
2answers
166 views

SQL Profiler - Insert values?

I setup an SQL profiler to run, but I am not seeing any values for updates/inserts. Is there a way to see them? All I see is stuff like this: insert into some_tbl(id, col1, col2, col3) values ( @P0 ...
0
votes
2answers
57 views

Full Transaction Log on closed source system [duplicate]

I have a closed source application which has the transaction log filling up on a daily basis to 60+gigs. I have ran a trace on the database and no inserts and updates are occurring. The following ...
21
votes
2answers
2k views

Why does query error with empty result set in SQL Server 2012?

When running the following queries in MS SQL Server 2012 the second query fails but not the first. Also, when run without the where clauses both queries will fail. I am at a loss why either would fail ...