How best to handle non-normalized data
Hi,I am trying to write queries against a vendor's database whose tables are in a very peculiar format. They are neither fully normalized nor de-normalized. Here is an example of the...
View ArticleConvert Columns to Rows
Hi I have data in this format,[code="sql"]CREATE TABLE [dbo].[Example]( [AZ] INT NULL, [NY] INT NULL, [PA] INT NULL)GO INSERT [dbo].[Example] ([AZ], [NY], [PA]) VALUES ('5', '7', '5')INSERT...
View ArticleProgressDB data dump to SQL server DB
Hi, How to move the ProgressDB data dump to SQL server DB. It is one time activity. More than 1000 tables are there like this.
View ArticleCTE multiple in a stored procedure
I have a developer wrote code using a lot of CTEs in a stored procedure.Basically, one CTE call another CTE call another CTE.CTE is sometimes easy to understand, but if using many I lose of track in...
View ArticleBetter query to accomplish this?
I've run into something that's a bit more advanced than I am, and the only way I know how to accomplish the desired result is through a sort of "brute force" query. Can someone help me figure out how...
View ArticleDisplay grid view image based on another column value
I want to display image based on another templatefield value.Example person num(0010200) and image saved in folder is 00102000.jpg , if person num(01234) and image saved in folder is 01234.jpg, etc....
View Articlefinding max value between dates
hi,i need to find the max values between two dates, the present one and a year from now.and my mind went blank :w00t::w00t::w00t::w00t:so i have a table [code="sql"]create table temp(dates...
View ArticleSQL QUERY FOR TOTAL HOURS
Dear All i need sql query to know the total hours spend,My table looks like this . action id ,creation_date,event_name,emp_number,1,7/21/2016 10:37:21 AM,IN,92342,7/21/2016 11:37:21 AM,OUT,9234output...
View ArticleSelect statements included within a function cannot return data to a client:...
I am writing a scalar valued function in SQL Server which takes input from 3 tables (uses a left outer join) and returns 1 variable called response_string. Here's the function code:[quote]CREATE...
View Articlecode handle by UI or other
I have a question about development. We have a .net app that counts student truant days. On UI, we'd like when users dismiss a case, it will auto populated today's date as default case closed date. But...
View ArticleUsing "Update" or "Merge" on 2014 SQL table
Hello,I am using SQL Server 2014 and I want to update all the columns in the table based on two unique columns from another table (AS400 table):For example column 1 "Sequence" and column 2...
View ArticleAttempting to change databases using cursor loop, but database won't change
I'm writing a script that, when executed, will drop any tables in a list of given DBs if the DB Name + Table Name combo does not exist in a table named CleanUpTableList. All DBs reside on the same...
View ArticleExecution based on completion of another transaction or session
Hi,I need a conditional logic or a logical script that would execute a script from another session (spid) when one of the session completes. For e.g if I am running dbcc shrinkfile for which the...
View ArticleCondition to exclude log backup when the full backup starts at a specific time
Hi,I am not sure how would I explain, but here is what I am looking for. Suppose, I have a full backup job that runs daily say at 1p and then I have a log backup job that runs every 30 minutes. I know...
View ArticleBackup Restoring - Insufficient free space
Hi Team,Restoring SQL Server database from one server to another.Actual Database size is: 14.3 GBBut while restoring getting below error.[b]The database required 127533776896 additional free bytes,...
View ArticleStuck on a problem with EXEC() (I think)
Hi All,I'm attempting to make a script which will pull in a list of all unauthorized DB users (and their corresponding databases) on a single server instance and then drop said users in one go. I made...
View ArticleIncrementing a varchar column
I am currently writing an SSIS package to migrate data from one third party database to a new third party one. This new third party uses a key in their tables of letter then 9 numeric.I have created a...
View ArticleSimple question about links
Hi I am new to this application and my question I believe is rather basic, so forgive me.I have two tables A and B below and I wish to get the followingOrder No Qty1 62 8Table A has order nos and other...
View ArticleCONVERT DATETIME to TIME and remove seconds and milliseconds
Hello Folks,How can I convert StartTime2 so that it equals StartTime1DECLARE @StartTime1 TIMESET @StartTime1 = '17:41:00.0000000'SELECT @StartTime1DECLARE @StartTime2 DATETIMESET @StartTime2 =...
View ArticleDeep End with JSON and HTTP
So, I am a dabbler, and have been asked to help out at work.We have an API that delivers a JSON file. I need to be able to populate a table in SQL with the JSON data through a sp if possibleThe URL is...
View Article