Get the date of a previous date in the same column without a set interval.
I have looked for an answer and maybe I missed it but I cannot find what I need.I have a table that I need to get the pervious date that a record was added for aspecific item, here is a sample of my...
View Articleparse a XML File into a SQL Table
Hello,I want to parse following XML File into a SQL Tablebelow is the Query I am using, however all I get is a huge Table with NULLSIs anyone able to help me further? Thanks,XML File:...
View ArticleI need some help solving an interesting problem
On a weekly basis, I need to understand how many invoices are in the system. I've made a couple of attempts at this and none of them have generated what I'm after. Every week we get invoices in. Some...
View ArticleVirtual Tables
Can someone explain just what a virtual table in SQL is?Is it a table that is created in RAM (primary memory) whenever it is needed as opposed to a table stored inside a database?So when they say the...
View ArticleSQL - Rollback and Commit
Hi,What exactly does Rollback do? I know that COMMIT applies the changes to the database system. The thing is, I've read that until commit is applied, the database in permanent storage is unchanged....
View ArticleIs there any other options to CHECKSUM?
For a data cleansing process I'm working on, I'm creating a new key, based on a combination of name + address.I wanted to use something in TSQL that will allow me to create an unique key based on an...
View ArticleSimulation of report parameters in T-SQL
Hi! I hope this is not a stupid question ... I'd like to "simulate" multivalue report parameters in t-sql. Background is, that I'm developing statements for report datasets with management studio for...
View ArticleHow to return a single value from multiple values based on mapping
I have the following tables:Category (has two columns "Input", "Mapping")OJOrange JuiceAPPApple JuiceSo OJ should be mapped to Orange Juice and so on.Here is the main table: ProductProduct (has the...
View ArticleEmployee Leave Date help
Hi I am having a few problems trying to complete this project and need some help.I am creating an employee management system and need help creating a trigger to stop insert of row into a leave table if...
View ArticleA simple query
Hi,this query works fine select tblProductDetails.ProductId as Id, stuff((select ',' + CAST(PD2.SpeValue as varchar(100)) from tblProductDetails PD2 where tblProductDetails.ProductId =...
View ArticleNumber of employees in a department of a branch
Hi I am having a few problems trying to complete this project and need some help.I need to create an after trigger that displays/prints the number of employees in a department and branch after a row is...
View ArticleFrequency Based Records
Hi AllA little overviewwe have a intake system where users submit requests and we process them . Some of our requests are recurring which means after we get the original request we create manual...
View ArticleHow do I calculate the size of files that I have UNC paths for
I am on SQL Server 2008 R2. I have a table that contains a field called [Location]. In that field is a UNC path to the physical file on the repository. Is there a way in SQL Server that I can say give...
View Articlereturn the end of week date using month and week number
Hi all,I am trying to find the date for end of the week using given month (201401, 201402...i.e, 2014 is year and 01,02 are months) and week number (01,02,03...) for the year. For example if my month...
View ArticleUsing SQL to call Dynamics GP procedures
I'm trying to enhance a stored procedure that takes accounts payable data from one database and inserts into Dynamics GP company database. The first half was working (The execute statement for...
View ArticleTuning a calculated field and sub query.
hi , I'm trying to optimize a stored procedure which has a lengthy expression and a subquery . Can any one help me out to fine tune below expresion and a join condition.extension_out = count(distinct...
View ArticleNeed Help with this SQL Report
Declare @Total int Select @Total=count(*) From v_Add_Remove_Programs Where v_Add_Remove_Programs.DisplayName0 Like '@DisplayName' Select Distinct v_Add_Remove_Programs.DisplayName0 as [Software...
View ArticleThe definition of object has changed
SQL 2008 R2I have a sproc that runs daily. Every week, at least once, I get the error that "The definition of object 'xxx' has changed since it was compiled." The sproc hasn’t changed in months. The...
View ArticleStored Procedure Update Timing
Hi All,I have wrritten a stored procedure that updates two different tables in the same database. The second statement is dependant on information in the table that first statement will change. So...
View ArticleDB Shrink
I am planning to Shrink a DB thats been in use for several months. I was going through information in this link - http://technet.microsoft.com/en-us/library/ms189080(v=sql.105).aspx and came to know if...
View Article