0
votes
3answers
45 views

How to display posted on date and time like1 hr ago or 30 min ago

i want to show the posted date like 1 hr ago.. or 30 min ago.. declare @date datetime ='2014-07-24 11:50:22.033'; SELECT CASE WHEN DATEPART(DD,@date)=DATEPART(DD,GETDATE()) THEN CASE WHEN ...
0
votes
2answers
44 views

How to provision the SQL Server Agent service after SQL Server Edition upgrade

I have upgraded SQL Server 2008 R2 Express to SQL Server Standard Edition. After I have upgraded it, the SQL Server Agent was stopped. I have tried to start but it fails. Only when I have changed ...
2
votes
2answers
100 views

Table with 4 million records - different size and performance in development and production

At my company we use SQL Express 2008 R2, which supports databases up to 10GB. We have 2 databases with almost the same number of rows in all tables. But, one of them is 4.5 GB in size (which is in ...
0
votes
2answers
47 views

Are #tables and #procedures 'not best practice' or 'bad practice'?

I am working on a project and part of it is an interface tool that executes SQL code stored in a xml file to import/export files. In the file, temp procedures and temp tables are used quite heavily ...
-2
votes
1answer
41 views

Using the “Select Top (100) percent vs. Select * , or selecting any column” [closed]

I wrote the first query below that I was hopeing to give me the exact same results that the 2nd query does, but it seems there is one recrod different: SELECT DocumentSourceName FROM ...
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 ...
0
votes
3answers
129 views

Is it possible to have the transaction log file write to a disk on a remote machine?

For the SQL server transaction log file, it is possible to set its target file to a disk on a remote machine? I am working on a BI project. In its current iteration, when the data warehouse ...
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
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 ...
2
votes
1answer
141 views

Database deployment script for SQL Server 2008 has different behaviors

Using Visual Studio 2008, I have compared schemas between remote SQL Server database with scripts hosted in a TFS server. The goal was to generate a migration script that would update the remote ...
0
votes
0answers
45 views

Transactional Replication

SQL server 2008 R2. I have set up transactional replication on 40 tables in a database (other tables don't replicate). There was an issue in the morning and it is fixed now. I resynchronised the ...
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
0answers
96 views

send custom email when SQL Server job fails

I have setup a profile and account for sending mail using DatabaseMail. I have a SQL JOB. If the job fails, I receive an Email Till this point, everything works fine. This is what the email looks ...
0
votes
1answer
41 views

Rebuild Index in system database

I use SQL Server and have multiple indexes in system database whit index fragmentation 30% or more. I don't know that SQL server manage system database index automatically or I want to manage them. ...
0
votes
1answer
620 views

How to convert sql server table data into MS Access(.mdb) file

I have SQL Database table with 6664055 rows, I want to convert this SQL Server table data to MS Access format(.MDB), How Can I do this?
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 ...
3
votes
1answer
431 views

sql server service broker queue pass parameter to stored procedure

Stored Procedure Create PROCEDURE [dbo].[InitServiceLog] ( @name varchar(max)=null ) AS BEGIN SET NOCOUNT ON; insert into [AdventureWorks].[dbo].[ServiceBroker_Log](Service) ...
1
vote
1answer
276 views

Does MAXDOP affect the number of tempdb data files I should create?

From what I have read, best practices for configuring tempdb includes creating multiple data files. The rule of thumb as I understand it is if you should create the same number of data files as you ...
2
votes
2answers
195 views

Scripting all of available databases to .sql files containing schema+data+users with single command

I have a SQL 2008 Express with 80 databases in it. I want to move these databases completely to another server which is hosting a SQL 2008R2 Enterprise instance. As i'm told it is better to script ...
2
votes
1answer
70 views

Database Design guidance required

I have scenario where there is Table T with columns PK,A, B, C,D TABLE t ( PK, A, B, C, D ) i have to insert data from different sources ie columns A,B,C,D are calculated separately.. and they same ...
0
votes
2answers
14 views

One of the Database Ownerhas been Removed and corresponding property changes in sql server

A database has been created on SQL 2008 by a user named user1 ,on dec 2013.Today ,we are going to remove that user(/owner) from the server.What will be the owner property of the database show then?
0
votes
3answers
592 views

Microsoft SQL Server does not start

I have problem with start SQL Server 2008. I needed copy database from one computer to seced. I copy only catalog DATA from my actually working server and past this catalog to my new fresh installed ...
0
votes
0answers
122 views

SQL Server 2008 R2 replication server runs faster than primary

I run a simple query like select * from table and i take the following results: primary database : 90 seconds replication database : 2 seconds The tables are identical and have the same indexes in ...
0
votes
1answer
329 views

Sql Server Fix Users

I Create a user in my database with following command : CREATE USER Test WITHOUT LOGIN I created a login with the Test Name. I want to link Test user with Test Login. When I use following command ...
1
vote
1answer
126 views

Can geography datatype Lat/Long properties be returned using a view in SQL Server 2008?

Hopefully the question is fairly self-explanatory. I've been ferreting through the, what appears to be quite minimal/poor microsoft documentation regarding both views and geography datatypes in the ...
3
votes
0answers
45 views

Any checklist/guide when transferring a database to a new server? [duplicate]

I'm looking for steps that I need to follow to transfer a database to a new server. So far I have: I restored the current database that I have in SQL Server 2005 instance to another SQL Server ...
2
votes
2answers
431 views

How can I change the number of @schedule_uid=N'????' to re-create a SQL Server Agent Job?

I have a SQL Server 2005 job in the SQL-Server Agent Jobs that I need to move/transfer to another updated SQL Server 2008 R2 instance. I was able to script it out and then use it as a new query window ...
1
vote
1answer
69 views

Server audit with more than 1.000 entries

On my Mssql 2008r2 I created a server audit for all login and logout: USE MASTER GO CREATE SERVER AUDIT audit_test TO FILE (FILEPATH = 'D:\Audit') GO ...
2
votes
1answer
830 views

SQL Server : keep track of all connections/disconnections

I have a Microsoft SQL Server 2008r2 SP1. I need to know which users connect to, and disconnect from, database. Ideally, I would like a list of (datetime, username, connect/disconnect). Can this be ...
1
vote
1answer
294 views

SSIS FTP Sending Blank Files

I'm supporting an existing data interface that is a series of SSIS packages (SQL 2008 R2) for sending and receiving data with a third party. The communication is being done through FTP, and it uses a ...
3
votes
1answer
116 views

SQL Server: Can Page Verify be set to Checksum on any database, or must I check compatibility?

In Microsoft SQL Server, I have some older databases set to "Torn Page Detection" rather than "Checksum" page verify. Do I need to determine if a given SQL Server database is 'compatible' with the ...
2
votes
1answer
113 views

Logging errors with extended events excluding some users

I use extended events to store database errors, like this: CREATE EVENT SESSION [ErrorCapture] ON SERVER ADD EVENT sqlserver.error_reported ( ACTION ( sqlserver.client_hostname, ...
0
votes
1answer
122 views

In Extended Events what is the difference between rpc_completed and sql_batch_completed? [duplicate]

I understand that rpc_completed is defined as the completion of a remote procedure call and sql_batch_completed is the completion of a t-sql batch. However can anyone explain in concrete terms what ...
1
vote
1answer
113 views

How to find what prevented in getting a lock?

Sometimes my update statements fail after 3000 milliseconds with 'Lock request time out period exceeded' error. That 3000 limit is coming from my application through SET LOCK_TIMEOUT 3000 setting, ...
1
vote
4answers
603 views

SQL Server Page Life Expectancy sharp drop

I'm trying to put my hands on the reason this SQL Server slows down sporadically. There are no patterns detected so far. It's a SQL Server 2008 R2 running on a Windows Server 2008R2 VM on top of ...
6
votes
2answers
695 views

Slow SQL Server Database (approx 2TB) - high CPU due to index fragmentation?

I've posted this over at ServerFault but didn't have much luck getting a response. I have a fairly large SQL Server database (~2TB). Most of the data is in one table (~6 billion rows). Two weeks ago ...
0
votes
1answer
406 views

Query with PIVOT fails with second LEFT OUTER JOIN to same table

I have a big query that contains a PIVOT and several LEFT OUTER JOINS. I need to add a second LEFT OUTER JOIN to a table that is already joined in the query. When I do this the query errors and I'm ...
9
votes
1answer
589 views

If a transaction is “committed” , is it then saved for sure?

If a transaction is committed successfully, can I then be 100% sure that it has been written to the database AND to the log files? Can I be sure that the data is SAVED ? Today our log files had ...
0
votes
2answers
471 views

Updating an indexed column performance impact in SQL server

I am trying to understand is there any performance impact if I am trying to update a column which is the key column of a non-clustered index in SQL server 2008? For e,g I have a column IsActive in ...
0
votes
1answer
328 views

Easy replication for SQL Server: Can it be set up like mongodb or Oracle?

This might look like a noob question... but it isn't. (I have 18 years of SQL Server experience, and three years of MongoDB experience.) The basic scenario is: -- Data Center has big, primary SQL ...
2
votes
2answers
126 views

Create Login command error [closed]

What is wrong here in following screen shot? I am trying solutions posted here and here to add a login
2
votes
3answers
475 views

SQL Server 2008R2 Database refresh in isolated environment

I would greatly appreciate your help on my database "refresh" issue. The scenario: I have 12 databases on a QA server that were restored there from a Production server approx. 2 years ago. Now QAs ...
2
votes
3answers
548 views

Is there any time where we should avoid cascading delete?

In SQL Server 2008, there is a Primary table which is linked to three other child tables by 1 to many relationship. So, we are thinking of using Cascading delete in the primary table, so that all the ...
3
votes
2answers
220 views

Truncated copy of a DB for a developer

I have an access to a DB (SQL Server 2008 R2). The size of the DB is about 40GB. I am a developer and I'd like to have a local copy of that DB to be able to work offline. Is there an easy way to get ...
0
votes
3answers
256 views

How can I insert '&' symbol in data

I have a source table where one of column has data like: Column SD SD .. .. JK Jk .. .. I want to load this data into staging in format of: Column S&D S&D .. .. J&K J&k .. .. ...
4
votes
2answers
272 views

Create a new database in SQL Server 2008 R2, but it is not Blank

When I try to create new database in SQL Server 2008 R2, it was created completely, but it is not a blank and empty database, there are many tables that come from another database. I also tried ...
2
votes
2answers
906 views

Domain group as single login, but still many different database users?

We want to use Windows Authentification on SQL Server 2008 within Active Directory. Is it possible to use an AD Group as a LOGIN to the server, but then to map the actual AD USER to a database user? ...
1
vote
3answers
2k views

Import .bak file in Microsoft SQL Server 2008 Service Pack 3 [duplicate]

I have a backup of my database as a TestDatabase.bak file but I am unable to restore it. When I try to restore I receive the following error message in SSMS: RESTORE could not start database ...
3
votes
2answers
133 views

SQL Server logs in Gmail

First off, I'm using SQL Server 2008 R2. When I set up my maintenance plan and got to the "Select Report Options" step, I selected to email the report to the Operator I already have set up. This ...
1
vote
0answers
50 views

Rows do not match Subscriber and Publisher

I have an transactional replication setup with updateable subscription that is utilized by an Application. When I insert a project into the application, the msrepl_tran_version is different on the ...