Query locks up
I'm aware that this query is horrible practice using the like statements, but due to variables that are out of my control I have to do it this way. I don't want to have a discussion about why I'm doing...
View ArticleWhy is nvarchar(max) size limited to 4000 characters
Im using SQL Server 2012 and in my stored procedure, I am using a dynamic sql with a variable with nvarchar(max) datatype. And my query length is more than 4000 characters and it is showing error....
View ArticleDuplicates
I am in process of creating a report with the below details.person_id,membership_id,first_name,surname,create_datetime,first_contact_date,promotion_id,promotion_description,description,heard_about_text...
View ArticleConfusing error message
Hi everybody,I am getting this error message when I try to run the same SQL Server stored procedure using different parameters:--------------------------- Error accessing server data...
View ArticleRemoving users from active directory groups
Is there a way to remove specific users from specific active directory groups using SQL?Need to create a nightly process that gets a list of users from a SQL table and deletes them from specific active...
View ArticleCounting unique records from 2 columns in SQLServer
Please need help to solve this issue I have a table Meeting PersonOne PersonTwo Ajay Bharat Ajay Elas Chetan Deepak Deepak Chetan Chetan Deepak Farooq Ajay...
View ArticleTo display data on month basis and calculations
Hi All,I am little new for writing this TSQL query. Can someone please help me here. I would really appreciate.I have 2 tables here1. table name: Budgetcolumn: Budget ID,...
View Articleneed to fetch the database performance report in the sql server for one week
Please suggest how to fetch the database performance report in the sql server for one weekBest regards,Vishal
View ArticleMove and Rename file
I am trying to move and rename all the files with extension csv in the folder. c:\folder\a.csv c:\Newfolder\a20141151011.csv datetime append after moving c:\folder\b.csv...
View ArticleSQL: Add Values to Grouping Column
I am having a lot of Trouble with a Scenario that i think some of you might have come across.(the whole Thing is about Business Trips, two tables, one filled with payments done on Business trips, and...
View ArticleForce Query To Return 0 not null
This is my syntax and it does not return any results, which is accurate, but how can I set it to return a '0' instead of a blank result set? I REALLY need this to take place within a query and not a...
View ArticleBecome our FIRST Microsoft TechNet T-SQL Guru of 2014!!
Happy New Year!Time for a fresh start!We're looking for the first Gurus of 2014!!This is your chance to make your mark on the Microsoft developer community.All you have to do is add an article to...
View ArticlePass array of values from trigger to stored procedure, then cycle through...
I'm confused. I'm a programmer, but have very little experience programming in SQL Server. Working on a project designed by someone else and we need to make some changes to the existing trigger/stored...
View Articlegroup by select statment
I have the following table:select '1' as OrgKey, '123' as PolNum into #temp union select '1' as OrgKey, '234' as PolNum union select '2' as OrgKey, '456' as PolNum union select '3' as OrgKey, '678'...
View ArticleHow to put grouped results all on one line.
I amt trying to get Principal, Interest, Principal YTD, Interest YTD from a transaction table to get them all on one line, but I can't seem to get it. I have a script here that can run without...
View ArticleSelect statement result set to large
Hi I am not sure how to pose this question but here goes.I have a select statement joining tables from two databases where the result set returns matches for every occurrence of the items in the select...
View ArticleSQL Server 2012 - xp_cmdshell - second call fails.
I have just upgraded a system from 2008 R2 to 2012 SP1.I have an issue with a scheduled SP that fails 'randomly' whilst processing/emailing a series of files created by a previous SP.The SP gets a...
View ArticleHow to see difference two columns
I have two tables:- Table1Coulmn1100Table2Coulmn1150Now I want to see difference between these two tables. Basically I am expecting:-Coulmn150I am using SQL 2005/8. How to get it? Any help would be...
View ArticleSorting Order
INSERT INTO tbltmp VALUES (769,'BBB','2011-06-30','2011-09-30'), (769,'BBB','2011-12-31','2012-03-31'), (769,'BBB','2012-03-31','2012-06-30') SELECT * FROM tbltmp EXPECTED OUTPUT: 769 BBB 2011-06-30...
View ArticleUnwanted extra character '?' is appending with text string
Hi,I am trying to insert an NTEXT value from one table T1 to another table T2 within a database.Table structures are as below;Create table T1 (T1ID INT NOT NUll, SourceColumn Ntext null)Create table T2...
View Article