0
votes
3answers
48 views

Matching two rows in a single table if two specific keys have different values

I have a table called settings in that there are two columns and data like following. settings value ------- ------ depots 12 projectid 156 client ...
-5
votes
0answers
35 views

Microsoft SQL Server 2008 error 29 [closed]

A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and ...
0
votes
0answers
18 views

how to check the condition before running the sequence container in ssis2005

I need to split the DB into Current(2012,2013,2014) and History(previous to 2012). Every year I need the oldest year should move to history DB i.e if 2015 enters then 2012 should move to history. ...
0
votes
2answers
50 views

Transfer all tables from a schema to other schema

I have two schema. Schema1 and Schema2 How would I transfer all the tables from schema1 to schema2?
0
votes
1answer
33 views

Print the execution time on messages Pane?

How I can print the execution time of each query on messages Pane? For example the Select * from tbl1 runs for 10 mins then Select * from tbl2 runs for 15mins and so on.. Select * from tbl1 Go Select ...
1
vote
1answer
27 views

How to update a single record in a table based of foriegn key ID in another table?

I am still very new to sql. I am having troubles updating one table. I am sending information from a web application into Microsoft SQL 2008 database. I have a table called EmployeePermissions that ...
1
vote
1answer
36 views

set date value based on other row values

Sorry for the Header, I can't find the right way to describe what I want, possibly the reason why I can't get a solution by googling :) ... Here my problem: I've got a table with the following ...
1
vote
4answers
111 views

Is it ok to change from full recovery to simple recovery in Sql Server

I have an old database - a users membership/role that was setup automatically by an ASP.Net 2 application years ago: The Sql Server version currently running is: Sql Server 10.5.1617 The users ...
4
votes
3answers
118 views

Virtual Log Files (VLFs) Fragmentation

I have a database with 160 VLFs. How do I determine whether the VLFs are fragmented? Further, how do I find the percentage of fragmentation? Another thing that I want to confirm: Are the following ...
1
vote
1answer
38 views

Get data per Customer and per Date

How will I get the all the date even though there is no order between two dates? Sample Table OrderID | Date | CusID 33942 | 6-21-2014 | 6005 34059 | 6-20-2014 | 4003 53333 | ...
0
votes
1answer
56 views

UPDATE not working properly with linked server

Please see a question I asked here earlier: http://stackoverflow.com/questions/24324823/update-not-working-properly-with-linked-server Dommer suggested using OPENQUERY and this does appear to resolve ...
1
vote
2answers
48 views

Making a Database Online [closed]

I am so confused with this issue, I have vb.net application and it has a sql database . Now, I want this application to access the sql server from anywhere , because there are many clients sharing ...
1
vote
0answers
41 views

Stored procedure taking much longer than query [closed]

I have a simple code segment that runs in about 1 second when run alone, but more than 5 minutes when deployed as a stored procedure. I'm using sql server 2008. Unfortunately, I can't post the code ...
1
vote
2answers
45 views

How to get the first or last row in ordered result set, depending by column value?

I have the follwoing result set from the table PUNCHREPORT EMPLID Name PUNCHDATE PUNCHTIME DEVICETYPE .................................................................. 70 ...
0
votes
0answers
22 views

Reducing log files? [duplicate]

I have a database that has a log file of nearly 80 GB. Database size 180 GB. The recovery is set to Full. What is the correct way to shrink the log file without using the shrink option in SSMS as ...
-1
votes
1answer
34 views

combining two CTE in a single query

Here i have two CTE and i need to select values from these two CTE as a single query. I can able to select values from a single CTE at a time but i dont know like how to merge these two CTE and select ...
0
votes
1answer
52 views

getting error incorrect syntax near @certificate

I have created a certificate and now I want to remove certificate signature and drop the certificate. When I supply the certificate name directly it is working but when I'm making use of local ...
0
votes
1answer
80 views

How to get the nTH row in ordered result set?

I have the follwoing result set from the table PUNCHREPORT EMPLID Name PUNCHDATE PUNCHTIME DEVICETYPE .................................................................. 70 ...
0
votes
1answer
71 views

How to restore Network backup to Network Path in SQL Server 2005?

I am trying to restore network backup file to network path.. is there any way to do it? I am using SQL Server 2005 and code.... RESTORE DATABASE DB_NAme FROM DISK = ...
0
votes
2answers
13 views

SQL Server Management Studio is not available

When I installed SQLManagementStudio_x64_ENU.exe I am not able to connect to my server. In the image (1) session, I am not getting server name. Also in (2) session also I am not getting it. Is there ...
-4
votes
1answer
27 views

Data type in SQL Server 2008 [closed]

If I want to store both values in single variable means in 'days' variable, it should accept 1 day as well 1.5 days. In this case which data type i should use in sql server 2008? Thanks in ...
0
votes
3answers
108 views

How to improve this query performance by indexing properly?

I have following select query, and I need to improve the performance of this query. Can anyone suggest me how to convert the clustered index scan to index seek? DECLARE @now DateTime; DECLARE ...
4
votes
1answer
87 views

How to restore symmetric key on the new database?

I have an issue with symmetric key restoring on the another database. I have table in the first(old) database with encrypted column.(The table contains encrypted data) The key in the old database has ...
2
votes
0answers
51 views

Network and memory waits after massive ALTER

We had to do a massive ALTER to our DB, changing one central table's PK to BIGINT due to approaching ID's generated in the 2 billion range. Due to this, several hundred referencing keys and indexes ...
5
votes
2answers
311 views

Performance hit of CONVERT from nvarchar to money (SQL Server)

I have a dollar amount value, that for historical reasons has always just been stored in an nvarchar field. Now that we are storing many more rows than we have in the past, and are using this field to ...
1
vote
1answer
69 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 ...
2
votes
2answers
104 views

Need help performance tuning a query

Basically, here is the design of the table (the part that is necessary): id | dt -------- 1 | 2014-05-13 2 | 1900-01-01 3 | 1900-01-01 4 | 2014-05-12 5 | 1900-01-01 So what I am trying to do ...
0
votes
0answers
15 views

SQL Server 2008 database is not coming online after restore.. Pleae need help asap

I have restored a 1TB database and now it shows the restore completed 100% but the database is not accessible. sp_who2 has a SPID 50 performing this restore but current command its showing is ...
2
votes
1answer
55 views

Select query - group by and sub group by

CREATE TABLE [dbo].[temptable] ( [Id] INT NOT NULL PRIMARY KEY IDENTITY, [uid] INT NOT NULL, [pid] INT NOT NULL, [event] INT NOT NULL, [timeStamp] DateTime NOT NULL ) I want ...
1
vote
1answer
41 views

Order of output row in random order [duplicate]

When I do select query on single table then I get output rows ordered by primary key which is perfect, following query: select * from recondata where importid=131; but when I'm joining this table ...
2
votes
0answers
19 views

enable database to work with Snapshot Isolation [closed]

I can't enable snapshot isolation ALTER DATABASE mydb SET READ_COMMITTED_SNAPSHOT ON; ALTER DATABASE mydb SET ALLOW_SNAPSHOT_ISOLATION ON; query still 0 rows working 5 days and nothing ...
3
votes
1answer
45 views

Safe to start Mirroring on Production Server?

We have a 350 Gig DB on SQL Server 2008. We intend to backup and restore it then immediately start mirroring. Is starting a mirror a dangerous operation to do on a production database ? Can I expect ...
0
votes
1answer
68 views

SQL Server monthly Backup

Im pretty new to SQL and some employee asked me if is possible to make monthly database backups. We do daily full backups to NAS server via cobian and we use SQL Server Management Studio to make ...
2
votes
1answer
134 views

Numbering multiple dates per delivery

I am interested in producing the following view where different delivery dates are numbered. SalesID Delivery Date DateNo SO00000014 2014-02-21 1 SO00000015 2014-02-13 1 SO00000016 ...
1
vote
3answers
68 views

New SQL Server 2008 instance, load old instance DB's

BACK STORY: I'm a developer with a local instance of SQL Server 2008 on my workstation. I just recently upgraded my motherboard and found out (much to my dismay) the old motherboard's RAID drivers ...
1
vote
0answers
38 views

Multiple login mappings for linked server

Can we assign two logins for two different databases on target server. For example, I would like to create a Linked Server between ServerA and ServerB. ServerB has two databases on it and both using ...
0
votes
0answers
175 views

Transaction Time out error C#

Database Type : SQL server 2008 R2 Issue description: There are two machines. One is server machine(OS- Windows server Enterprise) another one is client machine(OS- Windows 7 professional). In Both ...
1
vote
1answer
87 views

Using EncryptByPassPhrase in where condition

I am using EncryptByPassPhrase of sql server. But i am not able to use where condition properly. DECLARE @login_details TABLE(uid integer,username varchar(10),password varbinary(100)) insert into ...
1
vote
1answer
104 views

Take database backup of a SQL server 2012 from local SQL Server 2008 R2

I have a SQL Server 2012 installation that has some issues with SQL Server Agent because of which I cannot schedule a job or a maintenance plan to take backup. What I am trying to do is to create a ...
1
vote
0answers
57 views

What SQL Server Edition to use [closed]

I am a programmer and I have been asked to identify a Sql Server Edition suitable for our intranet web site. There will be 15 users connecting to web site. But we use one windows account to connect ...
2
votes
1answer
76 views

How to monitor load on database server

Could anybody please suggest me a way to monitor the load on my database server? What perfmon counters should I monitor on daily basis and confirm that load on the server is increasing day by day [or] ...
4
votes
2answers
183 views

Update Statement takes forever to complete [closed]

I have table around 1250000 records, and 80 columns Table Structure CREATE TABLE [dbo].[Table] ( [Column1] [int] IDENTITY(1, 1) NOT FOR REPLICATION NOT NULL, [Column2] [int] NULL, [Column3] [int] ...
6
votes
0answers
208 views

Is this a race condition or bug in sql server using serializable TIL with updlock? [closed]

I've been staring at this problem for almost a week now. I'm getting a deadlock in some query, and I've reduced the problem to these reproducible steps: Create a database with: create table offering ...
0
votes
2answers
106 views

DMV queries for capturing most frequently used queries and worst performing queries [closed]

Can anyone provide dmv query to achieve the following Query to capture frequently used stored procedure Query to capture frequently used ad-hoc queries Query to capture worst performing stored ...
0
votes
1answer
68 views

how service sid operate under the covers?

This question is out of curiosity and it left me in confusion whether service account as any role to play in sql server startup and shutdown? Can anybody explain how sql server 2008 Service Sids work ...
2
votes
2answers
209 views

How do I Delete A Database And Log Files With SQL 2008 Script?

While working on making an automated Delete and Restore script for my backups I ran into a snag. I can not delete the database; however, the delete button works exactly how I need it to. Can anyone ...
9
votes
3answers
1k views

When a previously-fast SQL query starts running slow, where do I look to find the source of the issue?

Background I have a query running against SQL Server 2008 R2 that joins and/or left-joins about 12 different "tables". The database is fairly large with many tables over 50 million rows and about 300 ...
0
votes
2answers
41 views

Having DB Mirroring and Replication together

Can anybody help me understand why do one go combination of Database Mirroring + Replication. Why can't I just have Database mirroring for high availability of my database. What is the need of ...
0
votes
2answers
49 views

How to change the path of data during database restore + SQL Server 2008

I am trying to restore a big database in SQL Server 2008 R2. The database is about 700GB in size. My SQL Server is installed in C drive which has only 100GB of space left in it. I have the .bak file ...
6
votes
1answer
269 views

Free space of mdf and ldf does not match with database free space

In SSMS I saw file size related properties and found below details for one database. Here values does not match with other properties. Here size of the mdf, ldf and total size matches with other ...