SQLServerCentral - www.sqlservercentral.com

A community of more than 1,600,000 database professionals and growing

Featured Contents

Featured Script

The Voice of the DBA

Byte Me: Deep Insight

Bob Lang from SQLServerCentral.com

Join the debate, and respond to today's editorial on the forums

ADVERTISEMENT
14 SQL Server Backup Questions You Were Too Shy to Ask

14 SQL Server Backup Questions You Were Too Shy to Ask

Read Grant Fritchey’s free PDF and get the answers to some of life’s big questions, like, “How do I retrieve a table from the log?” and, “Are SAN backups enough?” Download the free article PDF.

SQL Monitor

Get alerts within 15 seconds of SQL Server issues

SQL Monitor checks performance data every 15 seconds, so you can fix issues before your users even notice them. Start monitoring with a free trial.

SQL Compare

Once Upon a Time in Compareland…

Jack spent two days manually checking his database upgrade script for mistakes. Then his boss sent him the license key to their newly purchased SQL Compare. “It’s so fast” he sobbed as tears of joy quietly plopped into his beer at 6, hours before he thought he’d be able to leave the office that night. Read more about SQL Compare.

Featured Contents

 

Stairway to T-SQL: Beyond The Basics Level 9: Dynamic T-SQL Code

Gregory Larsen from SQLServerCentral.com

There times when you need to write T-SQL code that creates specific T-SQL Code and executes it. When you do this you are creating dynamic T-SQL code. When writing dynamic T-SQL you need to understand how dynamic code opens the possibilities for a SQL injection attack. More »


 

Free eBook: Performance Tuning with SQL Server Dynamic Management Views

Additional Articles from Red-Gate

Dynamic Management Views (DMVs) are a significant and valuable addition to the DBA's troubleshooting armory, laying bare previously unavailable information regarding the under-the-covers activity of your database sessions and transactions. More »


 

Calculating and Verifying Check Digits in T-SQL

Additional Articles from SimpleTalk

A lot of numbers that we use everyday such as Bank Card numbers, Identification numbers, and ISBN codes, have check digits. As part of the routine data cleansing of such codes we must check that the code is valid- but do we? Dwain Camps shows how it can be done in SQL in such a way that it could even be used in a constraint, and keep bad data out of the database. More »


 

From the SQLServerCentral Blogs - 5 Tips for Finding SQL Server System Data

derekwilson74 from SQLServerCentral Blogs

Regardless of the type of development (application or reporting) that you are performing on SQL Server.  There are 5 items... More »

Question of the Day

Today's Question (by Sean Pearce):

What will the following query return? (the number of rows, or the error)

SELECT
    COUNT(*) AS Result
FROM
    sys.databases d1
INNER JOIN
    sys.databases d2
        ON UNICODE(CAST(d1.name AS VARCHAR(255)) COLLATE Latin1_General_CS_AS) = UNICODE(CAST(d2.name AS NVARCHAR(255)) COLLATE SQL_Latin1_General_CP850_BIN)
WHERE
    d1.database_id <= 4
    AND d2.database_id <= 4;

Think you know the answer? Click here, and find out if you are right.


We keep track of your score to give you bragging rights against your peers.
This question is worth 2 points in this category: TSQL.

We'd love to give you credit for your own question and answer.
To submit a QOTD, simply log in to the Contribution Center.

ADVERTISEMENT

SQL Server Transaction Log Management

When a SQL Server database is operating smoothly and performing well, there is no need to be particularly aware of the transaction log, beyond ensuring that every database has an appropriate backup regime and restore plan in place. When things go wrong, however, a DBA's reputation depends on a deeper understanding of the transaction log, both what it does, and how it works. An effective response to a crisis requires rapid decisions based on understanding its role in ensuring data integrity.

Get your copy from Amazon today.

Featured Script

CTE DML

kbhanu15 from SQLServerCentral.com

This script is an example explaining how to write DML using CTE.

More »

Database Pros Who Need Your Help

Here's a few of the new posts today on the forums. To see more, visit the forums.

SQL Server 2014 : Administration - SQL Server 2014

The table with Name of 'Table Name' does not exist.An error occurred when loading the Model. - Hi SQL Server Friends, This is regarding an error related to SSAS tabular instance . The error is "The table with Name of...

SQL Server 2014 is very slow - Hi, Just installed standard editon, put tempdb on SSD and configured buffer pool extension to SSD. Ran some production replay trace....


SQL Server 2014 : Development - SQL Server 2014

sp_send_dbmail truncates when attaching query results. - Installed SQL Server 2014 CU1. While testing sp_send_dbmail I noticed the query results, when attached are cut off or truncated....


SQL Server 2012 : SQL 2012 - General

Step Out as One Hot Couple - Sofia Vergara and Joe Manganiello heat up the streets of Los Angeles. It doesn't get much more gorgeous than these two. After...

RESTORE DATABASE - BUFFERCOUNT - Anyone have a good description of what the BUFFERCOUNT option does in a RESTORE DATABASE command? Can't find anything online...

Microsoft Baseline Configuration Analyzer 2.0 showing only 2008 R2 BPA - Hello experts, I'm trying to run the Microsoft SQL Server 2012 Best Practices Analyser (BPA) against a SQL 2012 server. First...

RAISE ERROR to THROW conversion - Hi, I have an old proc like below which I want to update to use THROW. Looks like THROW can save...

Allow a low privilege user to execute a stored procedure to create db users - I have a requirement to allow a user to restore a database and then create database users and add them...

Need help on Configure linked server with Failover partner - Hi, Firstly, I don't to it is possible to create Linked server with Failover partner option. I can query when primary...

Suggest me the best choice regarding Importing Data & Indexing - Hi Friends, I have a CSV File, I am importing this into SQL Server using SSIS package through Flat File source...

SQL 2012 Multi Instance Cluster - DTC - Hi all I am required to set up a multi-instance SQL/Windows Cluster. Windows 2012 Ent/SQL 2012 Ent There will be 12 instances across...

Index Maintenance and Update Stats - Hi there I am using Ola Hallengrens scripts for index and stats maintenance but I am wondering what most people to...

Converting Directory File Path into HierarchyID - I am trying to create hierarchyID for a directory file path. Can anyone please help and give any suggestion on...

15 minute interval report between two dates with total for each interval - Hello, I’m trying to create a report which will give me a break down of how many unique vehicles have been...

Insert sequence number - I need help to code to add sequence number. One claim number may have various max sequence number. For example, 1) Claim...

Database Data Files out of Sync - I've stepped into a new environment and have never dealt with multiple data files on user databases only with Temp...

Restart Computer Prompt - PendingFileRenameOperations does not exist - I am attempting to install SQL Server Express 2012. Th setup support rule to "restart computer" continues to fail. Based on...

Trigger after UPDATE INSERT based on column value - Hello All, I would like to change a value after the table updates \ inserts a new row based on the value...

Availability Group Listener Creation - I have just set a SQL 2012 availability group up, testing it is working and all seems fine. I am not...


SQL Server 2012 : SQL Server 2012 - T-SQL

Please help me debug this SQL - Hi All, I've got this CTE and it's giving me fits. I'm getting the following Error which I can't track down. [b]Conversion...

How To Group By Values Over None Contiguous Data - HI Guys I was wondering if anyone can help me. Im trying to generate a list of data such as this [code="other"] STOCKID MIN_WKNUMBER MAX_WKNUMBER...

How to run a SQL job using different account. - Hi I have a job that needs to execute with different account. I figured i need a proxy so i...


SQL Server 2008 : SQL Server 2008 - General

Non-Clustered, Composite Primary Key - Hi All SQL 2008R2 I have a non-clustered, Composite Primary Key. It is the natural key from the business domain and is...

Having issues transferring file from 1 server to another. - I d' like to get some help with the problem I am having transferring the backup file (42GB) from 1...

Tempdb not releasing the space - I did try shrink the tempdb database then file. Also, restart SQL Server to release tempdb space to OS. But...

SQL 2008 - CXPACKET - I have an table with half a million records. A simple SELECT of 500 rows takes very long to finish....

changing a columns data type - Hi I have a requirement to change some fields from nvarchar(max) to something more suitable ie Nvarchar(50). When I check what 'dependencies'...

4 Data files and 3 Log files on same drives!! - I've got a Production server with 4 data files on D:\ and 3 Log files on L:\. which was migrated...

Cannot add foreign key - Hi, I dropped a foreign key constraint on a table and now trying to add it back again. However, I get an...

SNAPSHOT ISOLATION question/issue for sql server 2008 SP3 with security update - I'm running Microsoft SQL Server 2008 (SP3) - 10.0.5512.0 (X64) Aug 22 2012 19:25:47 Copyright (c) 1988-2008 Microsoft Corporation Standard Edition (64-bit)...

Snapshotting mirrored databases - Hi all I'd like some advice (and I can't find anything on Google) before I attempt this one. First some background..... Server A...

Datetime filter now working - Hello, I have no idea why i can't get this to work. In my where clause, i have a datetime field which...

Update based on multiple conditions in a single pass? - Hi, I have the following issue which I'm trying to resolve: essentially, I have a table of measurements on one side, then...

1 Quick question for all the DBA's - I am wondering if someone can help me out. I have become a SQL Server DBA about 7 months ago,...

Need Help parsing through the XML - i have an XML that needs to be written onto a table here is what i have done i created...

Simple question: How many users are connected to the sql server (instance)? - Hi all, I can't find perfect answer for this question: Can you check how many users are connected to the Sql...

Exporting SQL Jobs history - Hi, I know how to export a SQL Server job's history to a file by clicking on the Export button inside...

Generate script to restore log backups - Hi, I have more than 2000 log backup files in Z:\Backups\t-logs folder to restore after restoring the full database backup on...

Adding version to row to ensure user updates the current row version - Hi! I'm having the problem described in the following example: Table Samples: SampleID | Color 1 Blue User A open sample 1, its color is...

disk space 90% full... - Hi friends, Today i found that one server is having space issue, it has 90% disk space full and in that...


SQL Server 2008 : T-SQL (SS2K8)

Insert multiple values based on parameter - Hi All, I need to write SP where user select SUN to MON check boxes. If user select Class A with...

Where clause Integer Greater than - Hello! I'm not very technical on T-SQL so hoping this is an easy answer for someone. When I use the following...

Access EXCEL using OPENROWSET - I'm trying to access Excel file from SQL Server management studio using OPENROWSET using the below query but getting the...

Specifying Faiover partner in OpenRowset - We have a database,which has been mirrored.Also,We have an application which uses OpenRowSet to connect to this database. Is it possible...


SQL Server 2008 : Working with Oracle

Speed up Query by replacing subselects - I am trying to speed up the below code, which includes numerous subselect statements. Any thoughts on how I could...


SQL Server 2008 : SQL Server Newbies

Question about Parsing and Case Statement - I have to write a SQL script where one of the requirement is DeliveryIDcharacters 1-7 not equal to 'aaaaaaa' AND (If...

Comparing records to previous records in query - Hi, Here is a sample table: CustomerID------InvoiceID------Total ----95---------------3546--------#30 ----100--------------3547--------$12 ----95---------------3548--------$42 ----100--------------3549--------$25 ----100--------------3550--------$30 I'm looking to write a query that will only return the invoices for each customer that...

Performance issue related to Memory shortage? - Apologies if this isn't posted in the correct section - please redirect me if appropriate. I've recently started a new position as...


SQL Server 2008 : Security (SS2K8)

Users scheduling jobs - Is there a way to allow users to schedule a job that they don't own? If I'm reading it right -- and...


SQL Server 2008 : SQL Server 2008 High Availability

How to upgrade an Active & Active sql cluster? - Hi Experts, How to upgrade an Active & Active sql cluster? Is there any difference in upgrade for sql 2005 Active-Active cluster and...

Client side automatic reconnect fails after DB failover when SQL Server on non-default ports - Hi experts, I have the following issue: Three SQL Server DEFAULT instances with a database DBX (on two of them - Primary,...


SQL Server 2008 : SQL Server 2008 Administration

what is Hyperthred ratio? - Hi, In layman terms, what is hyperthread ratio mean? How is it used/useful in sql server ? Books online says, It is...

Shirnk Tlog(LDF) size? - Hi, Database High availability - Mirror setup configured, Principal server Tlog (.LDF) file size 25 GB, also warning messages recording at error...

Backing up a DB with log shipping turned on - I have a Db which has log shipping turned on. If I create a separate maintenance plan to do a...

SSRS Slowness - Hello Experts, I have situation where in SSRS is slow. I google regarding that and got a query to find the issue...

SOX Compliance - I apologize if this is not the correct place to post my question on SOX compliance....Did not know where else...


SQL Server 2008 : Data Corruption (SS2K8 / SS2K8 R2)

Dbcc checkdb says 0 errors but SQL error 823 produced - The db is working as normal, but in the SQL logs I see these 3 messages The operating system returned error...


SQL Server 2008 : SQL Server 2008 Performance Tuning

TempDB Avg Wait Times - Hi All, I am new to the forum and don't have a ton of SQL experience. In our environment we...

Taking long time for a single table execution - Hi, I am having a table "Test" with 70 columns. Out of them a composite primary key is defined with...

Force Parameterized Queries vs Missing Indexes - Working with a third party that would like me to enable the server option Force Parameterized Queries on MS SQL...


Cloud Computing : SQL Azure - Development

Accessing tables across databases? - Hi, As far as I am aware T-SQL stored procedures can only access tables in the database where the stored procedure...


SQL Server 2005 : Administering

The client was unable to reuse a session error - While trying to capture some info to be used to troubleshoot various problems, we created a trigger on the server...


SQL Server 2005 : Business Intelligence

Specify Values in SSRS parameter - Hi! I have a SSRS report , parameter @A uses 'specify values' (integer 1 and 2) as available values. What I need now...

SSRS hide column - I want to hide one of my column based on this logic; =IIf(First(Fields!TOLERANCE_CHECK.Value, "NetUnitPricingReport")= NULL, True,False) I get an error on the...

How to validate data of a flat file source with the data of different tables of my database? - Hi All, I am trying to find a solution for my task. My task is, I have a Flat File Source data....


SQL Server 2005 : Data Corruption

Repair Corrupt Access Database File - I am using MS Access 2010 and one of my databases on our shared network does not open for any...


SQL Server 2005 : SQL Server 2005 General Discussion

Adding a failed node back to cluster - Hi, This is on SQL Server 2005 / Windows 2003 environment. Node 1 of a 2-node cluster crashed, db is up and running...

comparision data between two servers - hi, I have two servers one is prod and test(replication of prod), I need to compare all the tables in all the...

Datime time based syncronization - hi, (i am Using windows 2008 ,windows xp and sqlserver 2005 ,2008) i have to put some data from one...

Spid of -3 holding permanent lock on database and tempdb does not have any tables after restart - I restarted my server's SQL Service when I could not kill a connection for nearly an hour. This caused many...


SQL Server 2005 : SQL Server 2005 Performance Tuning

Database Designing Related - Hi Friends, Please Help me...... I Have the below requirement........ 1. Design the DB for ‘Retail Stores Business’ where various products are on...


SQL Server 2005 : SQL Server 2005 Integration Services

format the output column in destination .csv - Hello, in ssis, I use a oledb source to execute a stored procedure and a flat file source to have the...


SQL Server 2005 : T-SQL (SS2K5)

Concatenating fields into one - Hi all I'm running SQL 2005 with SSMS 2012. I've got a table with the following fields: Visit ID Abstract ID QuerySeqID (Query Sequence ID) Response The...


Reporting Services : Reporting Services

Horizontal Axis show all categories - Hi All, In Visual Studio 2008 report builder I have a bar graph with a LOT of categories in the horizontal...

?? on adding a day to a dataset filter date - Hi I have a two date parameters (StartDate and Enddate) I want to filter dataset1 by Startdate thru Enddate + 1 Day , I...

Multiple Databases - I have a query where in I Union two separate SQL database queries. It works fine. Now I need to...

ssrs 2012 rdl connect to data source - On a ssrs 2012 reporting server, I want to install load uploaded rdls to a test report server. The rdls...

Using two entities in a Report Builder filter expression - I am wondering if anyone has any idea if it is possible to using two entities in a Report Builder...

SSRS Chart issue..Bars dont show up but data does - I have created a column chart in which the data is showing up properly on the x and y axis...


Reporting Services : Reporting Services 2005 Development

SSRS 2005 development using SSRS 2008? is it possible ? - Hello I think I know the answer to this one already thought I'd ask; is it possible to develop SSRS reports...

SSRS 2005 Limitations help - Hello In a new job I am having to work extensively with SSRS 2005; however pretty much all the SSRS development...

Paging in SSRS 2008 shows 1 of 2? - We just upgraded from SSRS 2005 and now when a report loads, the paging adds a question mark to the...


Reporting Services : Reporting Services 2008/R2 Administration

reporting services - I have two reporting services environments. First one is a native running on the same sql 2008r2 box using the...


Reporting Services : Reporting Services 2008 Development

Merge Vertically - How do I merge cells vertically, I am able to do it horizontally, but not vertically. I don't want to...

while printing records - WhilePrintingRecords; PageNumber > 1 The above one is the code in the crystal, which is used to suppress the details in the...

Help !!!! How to hide pdf export for specific report? - Hi all, Is it possible to disable the pdf export only for specific reports ?? I need your help. Lidou

SubReport problem - I need a report to display a bar chart report for top x items. The x value can driven from...


Data Warehousing : Strategies and Ideas

Hardware requirement new datawarehouse - Hello all, for our new datawarehouse I am trying to put together a hardware config. I understand this is not an...


Data Warehousing : Analysis Services

Input parameter based on text -- I don't want default values - Hi, I made my query in MDX, working fine. Moved it to SSRS report , not working completely. My question in short: I have...

Date Dimension Filtering - Hello, I have a date dimension [Facility].[Close Date] which I need to filter on. The criteria for the filter is to...


Database Design : Disaster Recovery

MS Access .mdb & .ldb database corrupted - I am using a A.mdb database. You know when connecting the databae Microsoft automatically create a .ldb file. Unfortunately my...


SQLServerCentral.com : Anything that is NOT about SQL!

Fantasy Football 2014 - SQLServerCentral would like to host a Fantasy Football league again in 2014. As of now, we'll run this league the...

Today's Random Word! - HI When you woke up today, or logged-onto Opera Forums, you may have had a dream, a thought, a scene...

Are the posted questions getting worse? - Is it me, or are the posted questions getting worse these days? I just read a post by someone apparently in...


SQLServerCentral.com : SQLServerCentral.com Website Issues

Active Threads link - The Active Threads link is really inconsistent lately. It does not appear most of the time. When this happens the...


SQL Server 7,2000 : General

Row are vanished from Table suddenly in SQL 2008 - Hi, I have an database name ABC. In this DB i have table name XYZ. This table has the rows more than...


Career : Certification

I'm totally new. Need some guide on SQL 2012 - Hi folks! I'll put it briefly.. I want to work with DB, but I know nothing about it because I have...

Any one like to share 70-433 legit exam practise questions (MeasureUp, SelfTest, Transcander) - Hi, I am preparing for exam 70-433 and looking to buy either MeasureUp or SelfTest practice exam question, please let me...


Career : Employers and Employees

Definition of a Database Architect - Been a loooong time since I last came here, seems like forever and yet remarkably familiar. Anyways, really got my curiosity...


Career : Job Postings

DBA Madison WI Dept. Of Public Instruction apply by 8/4 - http://wisc.jobs/public/job_view.asp?annoid=76346&jobid=75861

This email has been sent to {user_email}. To be removed from this list, please click here.
If you have any problems leaving the list, please contact the webmaster@sqlservercentral.com.
This newsletter was sent to you because you signed up at SQLServerCentral.com.
Feel free to forward this to any colleagues that you think might be interested.
If you have received this email from a colleague, you can register to receive it here.
This transmission is ©2014 Red Gate Software Ltd, Newnham House, Cambridge Business Park, Cambridge, CB4 0WZ, United Kingdom. All rights reserved.
Contact: webmaster@sqlservercentral.com