SQL Server 2008 (major build version 10.00.xxxx). Please also tag with sql-server.

learn more… | top users | synonyms (2)

1
vote
1answer
15 views

Auto Increment Key Pair with Start Digit at 200000 SQL SERVER 2008

I'm currently rewriting a front end for a program that handles interviews. I want to prevent an issue the older program had were during the tiny amount of time it was doing a lookup for the next ...
0
votes
0answers
18 views

SQL server is replicating to wrong subscriber

I have a publication which is intended to push data to a subscriber over the internet from a remote server to our onsite local subscriber but it ends up on a wrong subscriber.Here is the scenario: ...
0
votes
0answers
15 views

Connecting database ISSUE to remote database in mssql [duplicate]

May be This question seems repeated but please read whole question carefully. I have Microsoft SQL Sever in one PC (ex. machine A) and I wants to connect and get data from that database from another ...
4
votes
1answer
48 views

Can't get databases or its objects with powershell

I have Powershell installed both in my server and development pc. In my dev machine apparently have a most recent version of PowerShell installed or some its components of SQL Server 'sqlps'. My ...
2
votes
0answers
34 views

How to Replicate data between a hosted database and a local database

I have a Cloud hosted Database, maintained by a different company. Here is my scenario: Cloud Hosted Database SQL2012 - Need to connect through a VPN. We setup a local Server with with Dual NIC ...
7
votes
3answers
207 views

In what cases a transaction can be committed from inside the CATCH block when XACT_ABORT is set to ON?

Edit After getting first answers to this question I realised that I should narrow it down and changed the title of the question. Sorry for confusion. I've been reading MSDN about TRY...CATCH and ...
1
vote
2answers
97 views

Which data type should I use to store a 11 digit number [closed]

Which data type I should use to store an 11 digit number? It must store '0' as the first digit. For example, if I store 02421402015, it must show 02421402015. I tried using varchar and it shows ...
0
votes
2answers
67 views

Concatenate column values [duplicate]

I have a query that uses a couple joins to get a name from another table. It works okay except that I would like to combine "Examiners Name" instead of having multiple duplicates: ID | Name ...
1
vote
1answer
38 views

SQL Server Import Export Wizard Error - Server throw Exception

I am trying to move all database tables from one db to another as a nightly job. The first (export) db is running sql server 2008 - SQL Server Authentication - I connect with SQL Server Native Client ...
4
votes
1answer
244 views

'CONCAT' is not a recognized built-in function name

A client reported that they were running on SQL Server 2012, and we delivered some test queries for testing prior to a final delivery, however: 'CONCAT' is not a recognized built-in function name. ...
0
votes
0answers
46 views

Index Maintenance taking long time - Primary Key (Clustered Index) Varchar(35) [closed]

I have a table in my database that contains around 70 Million rows. Unfortunately the database designer had made the primary key (Clustered Index) column of type : Varchar(35). Obviously this is ...
0
votes
0answers
22 views

Count of application time outs in sql server

Can we get like below in sql server:
2
votes
1answer
32 views

String parsing: Extracting the filename from a URL

This is a link I have in a column of a table: http://earthexplorer.usgs.gov/browse/etm/1/11/2000/LE70010112000130KIS00.jpg There are like 1000's of rows like this. Is it possible to extract the ...
3
votes
0answers
48 views

SQL Server Incremental Backups Split

I am trying to recover a database where the incremental (log) backups are split between two methods (Carbonite/Zmanda and SQL .bak files). When I try to use the restore wizard I get the following ...
0
votes
1answer
40 views

Copy A Database

Is it possible to copy a SQL Server 2008 Express without launching SSMS? Little more back-story: my internal drive was removed and is now used as a USB drive (upgraded to a larger hard drive) and ...
-2
votes
3answers
57 views

Extract Portion From A Decimal [closed]

I need to extract any value > .5 from a decimal. Here is sample ddl Create Table #b ( fv decimal(16,4) fv1 decimal(16,4) ) Insert Into #b (fv) Values ('.8032') How can I capture the .3032 and ...
0
votes
0answers
45 views

Cannot See Stored Procedure on Linked Server

Cannot see Stored Procedure on Linked Server. I have connected two server using linked server, I can see only tables and views. I'm not able to see stored procedures. I have set RPC to true.
0
votes
1answer
44 views

Conversion failed when converting the varchar value 'Hours' to data type int

Conversion failed when converting the varchar value 'Hours' to data type int. This is my query: Sum(Cast(Cast(DATEDIFF(HH, ld_time_tracker_start_time, fld_time_tracker_end_time)%3600/60 As int) ...
0
votes
0answers
42 views

Query Freezes and SSMS Crashes

I feel like I have the syntax set on my query, but anytime I try to run this SSMS freezes and I have to reboot and once I get my PC back up and running no records have been updated. The table only ...
4
votes
2answers
56 views

Users running expensive queries

I am currently monitoring the expensive queries from the activity monitor for SQL server. How do I see who is running the different queries?
2
votes
0answers
16 views

TLS 1.2 with SQL Server 2008 [duplicate]

I have a VM where I use SQL Server 2008 as a black-box data store for a product I work with. I'm being told by my IT police that my VM is not (or will not be) secure in a short time unless I can ...
6
votes
0answers
108 views

DBCC Check DB issue

I have database of 99GB on this database when I am running DBCC Checkdb('IssueDB') It gives error as: Msg 8921, Level 16, State 1, Line 1 Check terminated. A failure was detected while ...
1
vote
3answers
356 views

Using Echo statement writes Echo is ON in the text file

Following code is used for write a number in the text file but instead it is writing "Echo is ON" into the text file. SET @CMD = 'ECHO '+@Ver+'>'+@Vercheck Print @CMD EXEC xp_cmdshell ...
2
votes
0answers
37 views

Max Degree of Parallelism for SQL Server 2008

Microsoft have recommendations around setting MAXDOP on various versions of SQL Server, but this (old) article raises some issues and recommends setting MAXDOP = 1 generally for SQL Server 2005 and ...
3
votes
1answer
27 views

Split Field Every 1K Characters

I have a field that can hold up to 3000 characters. I need to split this field into 3 individual fields split1, split2, split3, I have successfully been able to figure out how to get the beginning, ...
0
votes
2answers
50 views

Format Phone Numbers In SQL Server

I am using SQL Server 2008 and I found this solution which is only for SQL Server 2012 - what is the equivelant to format a phone number in SQL Server 2008? FORMAT([PhoneField],'###-###-####')
2
votes
1answer
48 views

Check 1 Table If No Data Check Second Table

I am passing into a stored procedure two variables @begindate & @enddate. I need to check firsttabletocheck and get a count of where csdate is between @begindate and @enddate. I then need to ...
0
votes
1answer
18 views

Accessing Registered Servers over Excel

With DBs in different countries, different servers but same structure, I have created registered server to access them when running certain queries for reports on SSMS. Thus far this is ok. However, I ...
0
votes
2answers
52 views

A simple Query causing high CPU in SQL Server 2008

We are noticing below SQL is causing very High CPU and its been executed 10,000 times. Is there a way we can tune this T-sql? SELECT ISNULL(max(trans_seq),0) +1 FROM inv_inventory_journal WHERE ...
9
votes
1answer
119 views

Why would suser_name() not reflect an AD account name change?

One of our users' names was legally changed, so we changed their Active Directory username to match - from domain\oldname to domain\newname. However, when suser_sname() is called by this user in a ...
1
vote
1answer
22 views

Find insert/update/delete queries that reference a partitioned view

I have just given a SQL Server with performance problems. The database is very large and use distributed views with a very large primary clustered key. (24 bytes). I would like to change this primary ...
0
votes
0answers
15 views

Replication jobs using proxy

I wanted to use a proxy account for replication agent checkup job on SQL Server 2012. This proxy works for other jobs. I got the following error: Executed as user: SQLUserID. Only members of the ...
1
vote
1answer
73 views

How to increase performance of UPDATE of ~ 50.000.000 entries

We have a query that uses a temporary table to update certain columns in the database: CREATE TABLE #NEW_OLD ( NEW nvarchar(20), OLD nvarchar(20) ); INSERT INTO #NEW_OLD VALUES ...
-2
votes
0answers
24 views

Calculating Cumulative Balance [duplicate]

I am trying to get balance for a certain customer Balance = Debit - Credit + Balance ( of last Previous Row ) and I have to get each Receipt Voucher under it invoice then order invoices by date. I ...
1
vote
2answers
104 views

Sql getting debit, credit and balance issue

I am using the query below to get Debit/Credit Balance from table statement SELECT t.[InvoiceID], t.S_Type as Type, t.Date, t.Debit, t.Credit, b.Balance FROM Statement as t CROSS apply ...
1
vote
1answer
38 views

Update Int Field [closed]

Why is my table not getting updated? For example, if I run this statement alone, I have a value of 6 returned Select COUNT(*) from #madeupland where SOapproved IS NULL however, when it is run ...
3
votes
2answers
313 views

Is there a Maintenance Plan that checks my database for corruption?

Is there any way to make a maintenance plan check all my databases on a single instance? Is the maintenance plan Check Database Integrity Task enough ?
0
votes
1answer
44 views

How can copy one column data of one table1 into other table2 column and other clumns table2 empty?

Here is my problem.I have two tables Stdd and result. stdd columns: id fname lname gender phonenum city result columns: physics chem math english urdu bio total id I want that in result table ...
6
votes
4answers
187 views

Multiple column concatenation

How to concatenate multiple columns in to a single row? For example: id name car 1 sam dodge 1 ram maserati 1 john benz 1 NULL mazda 2 kirk lexus 2 Jim ...
1
vote
1answer
32 views

SQL query for SQL Server backups [closed]

I found that SQL query for MS SQL server 2008 to display backups. SELECT D.name ,ISNULL(CONVERT(VARCHAR,backup_start_date),'No backups') AS last_backup_time ...
3
votes
1answer
69 views

Aggregation GROUP BY bottleneck

I have a performance bottleneck with a SELECT GROUP BY operation. Schema I have a table like this: CREATE TABLE [InverterData]( [InverterID] [bigint] NOT NULL, [TimeStamp] [datetime] NOT ...
3
votes
2answers
61 views

Is it safe to add new features to production SQL Server Instance

I need to add Integration Services Catalogs to our production instance of SQL Server 2008 in order to automate some SSIS packages. It wasn't included in the original installation 5 or 6 years ago. ...
13
votes
1answer
194 views

Massive INSERTs blocking SELECTs

I have a problem with a massive amount of INSERTs that are blocking my SELECT operations. Schema I have a table like this: CREATE TABLE [InverterData]( [InverterID] [bigint] NOT NULL, ...
9
votes
3answers
515 views

How can I drop all triggers in a single database?

I have a database with 104 triggers, is there a way to delete all the triggers with a single command from a single database called 'system_db_audits?
1
vote
2answers
45 views

Monitor executed SQL statements from external application [duplicate]

I have an external application connecting to a SQL Server 2008 Express database. Is it possible to monitor (view) the SQL statements that are generated by the external application at all? I am trying ...
1
vote
1answer
49 views

Two If's And An Else [closed]

I am trying to run this t-sql query but I keep getting an error of Incorrect syntax near the keyword 'END' How should this be re-written in order to execute properly? What I want to achieve is ...
1
vote
2answers
35 views

Update audit database name in triggers and views of main database?

I have a a system with two databases, main database and audit database. A lot of the triggers and table views in the main database and audit database are referencing from one database to the other. No ...
2
votes
1answer
30 views

Find Difference In Time

I am attempting to write a stored procedure to determine the difference in seconds between two times. If I were to hardcode the values I know I can use CAST(datediff(second, [start], [end])/3600.0 ...
1
vote
1answer
69 views

SQL current timestamp

I have made a featureclass for a utility company where they can register measures set up to mitigate problems with rats, called "mitigation measure". From this feature class it is possible to state if ...
2
votes
0answers
39 views

Database Corruption - object in sys.parameters does not have a matching row in sys.objects

I'm using SQL Server 2008 R2 and I have a strange db corruption. I ran dbcc check db and the output is: Attribute (object_id=1096186) of row (object_id=1096186,parameter_id=1) in sys.parameters ...