Change Null value to 0 in Dynamic pivoted query
I have the following SPROC which is used inside another procedure[code language="sql"]ALTER PROCEDURE [dbo].[AverageDemographicGroupAnswer]@GroupNumber int, @SurveyNumber int,@Demograp
View ArticleYour favorite database development/administration third party helper tools...
In order to share some of my own experience of third party SQL Server tools (mostly free) and In hope of learning about some new ones I would like to start a listing about my favorite third party SQL...
View ArticleOdd Behavior by Instance
I have multiple SQL Instances Our Developer and Integration Testing run on a virtualized host environment. I have User Acceptance Testing environment that runs on an Active/Passive cluster hosted on a...
View ArticleNeed Code Help - Query Entire Table's Data
I'm currently working on a project in Visual Studio 2015 along with SQL server 2014, with the goal of connecting to a web interface and pulling data from that interface to be displayed in a central...
View ArticleGetting error with Bulk Insert when data is encoded with double qoute
Hi,My table is getting loaded with 0 rows .i am using the below format file to load.Table DDL[code]CREATE TABLE [dbo].[TEST]( [VERSI
View ArticleReplication : can we list out transactions group by articles?
We are having issues with replication latency in our environment. I figured out it's from a particular database. But is there any way we can list out the particular table where heavy modifications are...
View ArticleSynonyms causing performance issue - database on same server
I have synonyms created that point to a database on the same server. I have been using them for 2 years with no problems until now. I have a query and if I point it directly to the database, it...
View ArticleHow to find row(s) with the same value in a recordset
Hi,I got this query, that gives me all the products(optionid) that are ready to be shipped:[code language="sql"]SELECT T_Order_Detail.OrderID, T_Order_Detail.OptionID,
View ArticleMerge statement when not matched insert
I am using merge statement to update and insert records to a target table.My question is when I use when not matched (by target) , can I add additional conditions?For exampleMERGE INTO TargetTable...
View Article[BIT] where already [Date](when happened)]
I was thinking about how to title this for a few milliseconds and I couldn't come up with anything better. I'm building a new database and while creating a table to store invoices I noticed I did...
View ArticleDisplay members with active cards
Hi guys,I have a little complicated issue,I want to display all the members in the Allmembers table, and their card number.However, when I have a member that have two or more cards ( one is active, the...
View ArticleAutomate weekly DB restore
All, I need to refresh our Dev from prod and I am wondering if someone can help me out since I am still at the beginning/learning stage of development.Current Backup file :...
View ArticleHelp with SQL Query
Hello All, I am new here and a Novice to SQL. I am needing help on joining the data below into a single row. Please see below Lets say I have a table with the below columns.
View ArticleRanking For each group
Hi All,I have the following table:declare @T table(ID int identity, NUM int);insert into @T values(0),(0),(0),(1),(1),(0),(0),(0),(1),(1),(0),(0),(0);ID NUM1 02 03 04 15 16 0<
View ArticleHaving an Issue with Contains while using multiple words with an AND operator
I'm having an issue with the following Contains Filter searching through 5 different columns in a table:FROM [db].[dbo].[table] where CONTAINS((Column1,Column2,Column3,Column4,Column5),' "KeyWord1" AND...
View ArticleFinding a string in XML column using sql server
1. I have a table with a xml column.2. I require to search for sub string in that xml column for all its node and value. Search should be case insensitive3. Structure of XML in each row is differentI...
View Articlestored procedure to get data form table
I have a table where it has weekdes column where it contains data in this format.Data looks like - Wk 1 Oct 2017Wk 2 Oct 2017Wk3 Oct 2017....Query to get data from table - select weekdes from...
View ArticleCreate a table and join it with another existing table
Hi guys,I have a query that executes certain columns, let's say something like that :Select ID, TransactionTime, Points From Members Where Points >= 20 Result : ID Tra
View ArticleUsing Print To Debug Stored Procedures
Hi Guys,This is going to sound like a really stupid question, but what is the proper way to use a print statement to debug a stored procedure? I've stuck some print statements in a stored procedure to...
View ArticleUsing PATINDEX To Determine If A String Is Alpha
Hi Guys,I'm trying to write an SQL Server function to determine if the value passed to the function is alpha. The value would be a word. Is it possible to use PATINDEX to accomplish this? This is...
View Article