Need to dynamically add grouping based on username
HiI have this simple query:[code="sql"] SELECT CompanyName as Company, Batch, USERNAME as [User Name], SQLUserName as [System User Name], --claim_form_type_id as [Claim Form Type], CASE WHEN...
View Articlefind date value from file name
Hello,I am trying to write an expression in SSIS to see if the file is older than 7 days then delete it.The problem is my file names are not consistent here. Like abc_vg-20161204.txt or...
View ArticleTrying ot Create Table Dynamically Based on Data in a Column
I am trying to create an employee table that lists every employee in a column in a stored procedure. The issue is that the number of employees could change from run to run, so I am trying to figure out...
View ArticleRe-Write SQL Query to a View
Hi to all. I need to rewrite the code below ideally as a View as calling application is unable to pass a parameter.The requirement:When the view is executed it should return data for the current...
View ArticleSSDT environment SQL 2014 SSIS
Hello SSC friends!I have a few questions about the SSDT environment, SSIS to be more precise.The initial installation of SQL 2014 and SSDT 2012 worked fine. A few weeks later, SSMS and SSDT stopped...
View Articleproblematic xml
Hello,I have a real weird xml that I need to put in a table in columns. The problem is that the xml itself repeats itself over and over again.so when i write the code to parse it it keeps going to the...
View ArticleDatabase variable with USE command
Hello Team,I need one help here .I am preparing one Stored proc for different object access. I am taking database name as variable @dbnow I want to use the database provided in SP input as USE @db in...
View ArticleHow toGet column name with changing value in SQL-server
How can we get the changing value with column name in a table ex:[Engineer no PostalCode FTEFieldWork Efficiency AllowCM DistrictName AllowPM100234 BE 0 1 1 District Wallony 0100234 BE 0 1 1 District...
View ArticleAggregate data in a row-like fashion
I have a SQL input table that is structured like the one shown below. Based on this input table I wanna create another table that aggregates the information in a row-like fashion as shown below. How...
View ArticleWindowing functions vs Non-deterministic ROW-NUMBER()
Since windowing functions make a big deal of the OVER ... ORDER BY clause, how can that be reconciled with the non-deterministic ROW_NUMBER() function, i.e. something like: [code="sql"]SELECT ClientNo,...
View ArticleDebugging CTEs
An annoyance for me is that a CTE doesn't seem to allow me to highlight-a-section-and-execute as I can with a SQL statement without a CTE.For example, if I have[code]SELECT Col1, Col2, ... long list of...
View ArticleBacklog records using MS Sql
I have a table 'Actions' like this.CREATE TABLE Actions ( Action_Id varchar(25) NOT NULL PRIMARY KEY, Open_Dt datetime NULL, Close_Dt datetime NULL);INSERT INTO Actions (Action_Id, Open_Dt, Close_Dt)...
View ArticleSearching in PDF-files with full text indexes
After trying it a few times in the past, again I was hoping to make SQL Server search in PDF-files with full text indexes.I did everything according to the instructions:- I've downloaded the filter...
View Articlecomparing xml column
hi,I have a table that contains one column that is has an xmlAnd it has come to my attention that maybe not all the xmls are the same. Meaning they have different nodes.How can I check it without going...
View ArticleBuilding BI from Scratch!
Hey guysI need some expert advice in building up our BI infrastructure from scratch, the raw data come from the 3rd party every week and we need to push this data into the SQL server after cleanup...
View ArticleSQL table locked infinity when access us from c# code
I have a code that execute this steps in some table: 1 - Update 5000 rows with will be to extract, is a bit column with value NULL 0 or 1 2 - Select 5000 rows 3 - Do some work in C# 4 - Update 5000...
View ArticleMax value in Case Statements
I have a simple logic but i am missing something in below query.For all the records with Max(column), set the flag to 1 else 0. how can i do this in Case statement?For Example,Table 1ID Date1 1/1/19002...
View ArticlePrimary key and foreign key relationship.
I have TABLES products1 and products2CREATE TABLE products1( product_id INT PRIMARY KEY, product_name VARCHAR(50) NOT NULL, category VARCHAR(25));CREATE TABLE products2( product_id INT , product_name...
View ArticleAdd two proc Logic in to single query - Help needed
The requirement for report was to display the Policy as per below logic. PROCEDURE [dbo].[spExceptionReport] @Month int, -- Should be a value from 1 to 12 (Not being used now) @Year int -- Should be 4...
View ArticleSSIS Package upgrade problem
Can I get some advice on deploying SSIS/SSRS solutions (SQL Server 2014) from Visual Studio? If memory serves, I think this was installed from SSDTBI_VS2012_x86_ENU.exe. (Data Tools exe)Situation is I...
View Article