This may be a stupid question, but I have a table of orders that consists of various data. I want to take by date all orders that have been completed but have not had a previous order in 180 days. I have this part done. What gets returned is Date, Count, Status. What I want to get is the various status's returned as headings. So I get Data, Total Order Count, Completed Count, Abandoned Count, etc. I'm returning this data to Excel for display. My original thought was seperate queries, but some of the data will not have a count so the ordering would be off. Any ideas?
If the SOURCE doesn't have column headings in a txt file (the format will be pipe delimited), how can I make it work (Through DTS) to load the source into my designed SQL Table? Thanks in advance!
Hi, I've got an IS package which reads a lot of records from a text file and loads that into the database. The text file has column such as Firstname, Lastname, phone number etc and same as the database table.
The problem: IS works fine if I have the text file columns in the same order as the database columns but for example if have phone number in the place of firstname (in the text file) IS puts the phone numbers as firstname in the database and moves all the columns dow the order.
Is there anyway I could force IS to use the heading names in the text file and put it in the appropriate database columns?
I have generated a report that requires the user to scroll down the page since it is fairly long. I want to be able to show the column headings as the report is being scrolled. Much like excel locking the column headings as you would scroll down the spreadsheet so you know what values correspond to what heading. How do I configure this report to do this? Any suggestion is greatly appreciated. Thanks!
I am relatively new to SQL and have experience with relatively simple queries and data manipulation. I have just finished creating a fully normalized database, which, of course, is presenting me with a few problems retrieving data. I'm not sure if I'm even taking the right approach. Anyway, I am trying to create a web search with a filter. I want my filter to be based upon different columns in a view, rather than rows in one column. I have the following columns:
I want to populate a drop list with these column headings. So I thought I would need a way to make a dummy column named Category or something, and then make each of these columns a row in the the Category colum. Can that be done?
we'd like our users to have the option of choosing the language (eg French) for column headings (maybe report heading too). I'm sure I'd have to provide the translations somehow but I'd like to know what feature, if any in RS2005 comes the closest to doing/supporting this, even if it is something like making column headings themselves dependent on a variable?
I'm using isqlw to generate delimited text files from scripts. There are several SET options available so that you can restrict the output to just the data in the script, for example SET NOCOUNT ON.
I can't find a similar SET option to suppress the column headings, although there is a tickbox that allows you to do this in Query Analyzer (Query -> Current Connection Options -> Advanced -> Print Headers)
DTS packages appear to support this, yet I can't find the setting from a dts file.
When I am using a SQL Query I have an ability to control whether or not I am able to Include the Column Headers when copying or saving results.
The control exists in the Options > Query Results > Results to Grid > Include column headings etc.
My question is how to get this same ability when attempting to copy the results of a VIEW vs. a Query. The idea is that when I setup a view it€™s a drag/drop type of query building (query building for dummies if you will). Once I have a view and click the Execute icon it will return all the records selected by the View. However, when I click the upper left/top box to select all rows and column and then try to copy/paste the records into Excel all the data copies just fine but the field name/column headers are not there. How can I get the header fieldname date to copy/paste from View result set that I'm able to copy from a Query result set? Thank you, Mike
I wonder if anyone can help with this. I have searched around and not found much on the topic which can resolve my problem.
History on the reason for using VBA and not C# or VB or VB.net etc. Whn I arrived at this company, there were no development tools so had to resort to Access and VBA. Of course, the routines I wrote are now set in production and I haven't had much time to convert them to c# and ASP.NET (which I have learnt over the past couple of years).
Anyway the problem is that I found on the SQLDTS.com site that I could in fact create and execute DTS packages within VB and followed the examples and got this working in VBA. Of course I created the DTS first and then saved it as VB, then used the resulting code with the VBA project etc etc. This worked well and we were happy.
The DTS packages I create and execute are to export data from SQL2000 tables to tabs in Excel spreadsheets.
Now I find that on my machine, when the objPkg.execute command runs, the Excel file is created but only the query column headings are populated into the excel file. No data is returned.
If I run this on a different machine it works (although having said that, the other machine is now starting to display similar behaviour on some routines).
we created a version of the Access 2000 MDB in Access 2003 some time ago and the Access 2000 still behaves correctly. The strange thing is that my machine has only started doing this incorrectly a little while ago (not sure how long now but could be as little as a couple of months). The routines are monthly processes so it's only going to show up as a problem once a month so the fact that it used to work on my machine and has only failed the last couple of times means that something must have changed on my setup. I am runningXP-Pro SP2 - fully patched, Office Pro 2003 and talking to SQL 2000 SP3a
is it possible that some windows updates or office updates are clobbering something which used to work?
If I allow the VBA to create the DTS but not execute it, I can execute the created DTS manually from SQLEM and it outputs data correctly.
No security access to the SQL databases/table has changed, nor have there been any changes to security on the file system where the files are written.
It's weird.
Any help would be gratefully accepted.
Annabel
I'm really lost and not sure whether I should look at driver versions, ODBC versions blah blah
I have a simple enough task to complete that I can€™t seem to find the answer to.
The task is this €“
Select table x from the database and write it to a flat file complete with that tables column headings.
Now I€™ve managed to set up an ole db datasource and selected the table and I€™ve also linked it to the flat file output. So now I can generate a flat file from the database. However no column headings appear in the flat file.
I can€™t seem to find anywhere (like a checkbox) that will also output the column headings to the flat file.
Now I can add in Headings manually in the properties of the Flat File Destination object but the columns that appear in the flat file don€™t appear to be in the order that I requested them in the SQL.
So the question is how do I automatically have the column headings appear for flat file output (ideally without me having to manually add them in).
If it can€™t be done and I have to use a vb.net script instead then would anyone have an example script of how to do it?
Thanks in advance for anyone who manages to answer this.
we are running 2014 enterprise. A couple of column headings (even with smaller font) are a little tall, as much as 6 "lines".   All headings in the respective matrices are aligned vertically as "bottom". When I save the report to excel, these taller headings get chopped off visually in their excel cell.  The cell contains the entire heading. It appears that the second "line" of the heading is the one that is most visible in excel.Â
How do I get these to be saved so user will see entire heading when opening excel doc? In the first matrix there is a text box directly above the matrix and only one row of column headings. In the second there is a higher column group heading containing month name above the problem headings.Â
I am trying to exclude records from a table where the ID column is the same but the Mail code Column is multi-valued.For Example: (the table looks like....)
is it possible to export a report to a csv file without the headings?
at best i have been able to hide the headings in the report, but when exported to csv file it includes a row at the top of commas, then the data follows. I need the file to be just the data.
Ok, so I need to count the Distinct records from column 1 in which there is not a true value in any of the records for that distinct column 1 number. Here is a short example of my records:dbo_dbWafer_Slicing
dbo_dbWafer_Slicing
WaferID SawDate SawRunNumber Pass
03-157.05 1/8/2008 9:54:00 AM 03-157 0
03-157.03 1/8/2008 9:53:00 AM 03-157 -1
03-157.04 1/8/2008 9:53:00 AM 03-157 0
03-157.02 1/8/2008 9:52:00 AM 03-157 -1
03-157.01 1/8/2008 9:50:00 AM 03-157 -1
03-165.06 1/4/2008 10:46:00 AM 03-165 0
03-165.07 1/4/2008 10:46:00 AM 03-165 0
03-165.04 1/4/2008 10:45:00 AM 03-165 0
03-165.05 1/4/2008 10:45:00 AM 03-165 0
03-165.02 1/4/2008 10:44:00 AM 03-165 0
03-165.03 1/4/2008 10:44:00 AM 03-165 0
03-165.01 1/4/2008 10:43:00 AM 03-165 0
So, how many Distinct SawRunNumbers had no passing wafers? In trying to do this I've come up with:"SELECT COUNT(DISTINCT SawRunNumber) AS BouleCount FROM dbWafer_Slicing WHERE (SawDate >= @MinDate) AND (SawDate <= @MaxDate) AND (Pass = 1) HAVING (COUNT(DISTINCT WaferID) > 0)" but that doenst work. It still counts records where pass = 0 for distinct SawRunNumbers even if one record within that SawRunNumber is passing. From the above sample data I should get a result of 1 not 2 or 3. Can I do this with this set of data? I'm using SQL Server 2005 EE.Thanks for your help.
what is considered the best practice for placing headings above dynamic row headers if you want them to float with the row headers when scrolling horizontally?
I know this is a known issue since SSRS 2000, but it seems that it hasn't been solved: How can I have column headings on a Matrix Report ? (not in the data region, just in the columns that identifies the rows).
All the workarounds and tricks that I have found are quite nasty and have drawbacks when you export to Excel, for instance:
- Using a table inside upper left blank area in the matrix report: Problem, when you export to excel you loose the Header.
- Using an rectangle and placing textboxes (tweaking with pixels... :-(): When you export to excel you get excel columns merged, quite bad if somebody wants to make some macros or calculations).
- Using a list report... well I need a matrix report :-).
Is there other way to implement this ? This is a known issue since 2000 came up, no really a solution available ? I have seen on SP-2 and there is no solution for this issue... please heeelp.
I have a SSRS 2005 report with a table and several groupings. These groupings are made visible with toggle items. I am trying to determine how to make the associated group headings (entered within table header) visible or not visible depending on the visibility state of the groupings.
Example: (initial state with group1 only visible) Group1 Heading Count Sum +Group1 999 999
(click + sign to make visible group 2) Group1 Heading Group2 Heading Count Sum -Group1 999 999 +Group2 888 888
etc.. for remaining groups
I've tried toggling the table header column the same way I did the group, but the group scope isn't available so I don't know what to use. (Manually putting it in causes report error.) I don't know what visibility expression to use because I can't figure out what report item I can look at to determine the group's visibility "status" in order to make an expression.
Any ideas?
Note: I did see a similar post from sadsac, but the "answer" didn't address this.
I have built a package in which i use a derived column to create a new set of columns and then pass the same to another target transformation.
The issue now what I am facing is, the re are certain number of records coming from source(16 rows) and gets processed before the Derived Column transformation, but after that, no records gets processed after the derived column transformation.
The package status shows as Success, but there is no records being written in the target table.
I am creating a query which will show patients that are enrolled in more than one program, but I need to exclude those patients that enrolled more than once in the same program. Here's part of the code:
SELECT member_id, service_id FROM pat_prg_info ppi
I try to set up a testing sample table which contain one integer project_ID field for table Sample around 500 records, and want the project_ID to be random number within 1 to 99, how to implement script todo it? thanks!
My question is concerned with the three columns below (customerID, RepairDate, CompletedRepair (Yes or No). The column name "CompletedRepair " is blank initially. I need to update the CompletedRepair column with this logic below:
- A customer comes to our store to fix their car, if we fix their problem on the first time and they don’t return later for this same issue, then the •CompletedRepair column = Y
- If a customer needs to come back to our store to re-fix the same issue within 7 days windows based on the RepairDate on the previous transaction then •On the last return transaction: CompletedRepair = Y (example: RepairDate =6/12/2006) •On all previous transactions: CompletedRepair = N (example: RepairDate =6/8/2006, 6/9/2006, 6/10/2006)
- If a customer needs to come back to our store to re-fix the same issue but out of the 7 days windows based on the RepairDate then •On the last return transaction: CompletedRepair = Y (RepairDate =6/12/2006) •On the previous transaction: CompletedRepair = Y (RepairDate =6/1/2006)
Every time customer comes to for car repair shop for a new issue or an old issue, we create a new repair transaction in our SQL db. The update on the "CompletedRepair " column will be run every day. Today's records will be run against with last 7 days records (based on Repair Date) to check when customer has been really fixed: the last fix counted Y, the previous fix counted as N but comparison in only 7 days. In other words, a repair today is considered as a completed repair when comparing with last 7 day repairs but it might become not a completed repair if this same customer would come back within next 7 days for the same issue.
The CompletedRepair column is dynamic column and is updated daily by using the logic above.
Below is the expected outcome after we update the Completed Repair column:
CustomerID Repair DateCompleted Repair
ab1 06/12/06 Y ab1 05/28/06 Y ab1 05/18/06 Y ab105/15/06 N ab1 05/12/06 N
Initially 5/12/06 had Y, when 5/15/06 transaction came, it took the Y and made the 5/12/06 become N. The 5/18/06 transaction did the same to 5/15/06 transaction, made itself Y and converted 5/15/06 into N. The 5/28/06 is Y because comparing with 5/18/06, it is out of 7 days window. The 6/12/2006 is Y because comparing with 5/28/06, it is out of 7 days window.
ab2 06/02/06 Y ab2 05/28/06 N ab2 04/19/06 Y ab2 04/14/06 N
The 4/14/06 transaction initially was Y, it became N when new transaction on 4/19/06 came. Same thing with transactions on 5/28/06 and 6/2/06
ab3 05/11/06 Y ab3 03/29/06 Y ab3 03/23/06 N ab3 03/12/06 Y
The 3/23/06 was Y, when new transaction on 3/29/06 came, it became N and the new transaction is Y. The 5/11/06 is Y because comparing back to 3/29/06, they are out of 7 days window.
ab4 05/11/06 Y
This ab4 customer came to fix her car only one time and don't come back. We supposed the fix was sucessfully and so we mark the CompletedRepair as Y.
I think that I would need to use SQL cursor or case statement for this but I really don't know how to start. Please advice and help me out. Any ideas and suggestion are really appreciated! If you need more information, please let me know!
Godwin writes "Hello, Heres my question.. I have 2 tables.2 paticular columns exist in both the tables. I want to be able to select those 2 columns on the 1st table and insert them on to the same 2 columns on the 2nd table.
Now,this 2nd table has another 3 columns that exist in another table.I would like to take those 3 column values from that 3rd table and insert it into the 2nd table by modifying those existing records in the 2nd table.In the 3rd table,there will be around 5 records...I want to copy the existing records 5 times in the 2nd table and insert the 3rd tables rows inside the 2nd table in that respective column for 5 rows.
I hope you understand what I mean...Im sorry for really confusing.. Please help me Thanks Godwin"
I have a MS SQL table with a derived column, for date the records were imported, and need to delete records, based on the content of this column. What I need to do is delete all records from the table with a date of '2011-11-18'. Now this column is a datetime column, so it contains the time info after the date, i.e. 2011-11-18 09:29:38.000, but no matter what command I try for this:
-Delete from table where Date_Imported like '2011-11-18%' -Delete from table where Date_Imported like '2011-11-18' -Delete from table where Date_Imported = 2011-11-18
It comes back saying "0 rows affected", even though I know there are records with that date in the table.
I have a scenario to compare previous records based on each ID columns. For each ID, there would be few records, I have a column called "compare", We have to compare all Compare 1 records with Compare 0 Records. If Dt is lesser or equal to comparing DT, then show 0. Else 1
We always only one Compare 0 records in my table, so all compare 1 columns will compare with only one row per ID
My tables look like
Declare @tab1 table (ID Varchar(3), Dt Date, Compare Int) Insert Into @tab1 values ('101','2015-07-01',0) Insert Into @tab1 values ('101','2015-07-02',1) Insert Into @tab1 values ('101','2015-07-03',1) Insert Into @tab1 values ('101','2015-07-01',1) Insert Into @tab1 values ('101','2015-06-30',1)
Insert Into @tab1 values ('102','2015-07-01',0) Insert Into @tab1 values ('102','2015-07-02',1) Insert Into @tab1 values ('102','2015-07-01',1)
select * from @tab1
1.) In the above scenario for ID = '101', we have 5 records, first record has Compare value 0, which mean all other 4 records need to compare with this record only
2.) If Compare 1 record's Dt is less or equal to Compare 0's DT, then show 0 in next columnÂ
3.)Â If Compare 1 record's Dt is greater than Compare 0's DT, then show 1 in next columnÂ
writing the query for the following, I need to collapse the continuity. If the termdate for an ID is one day less than the effdate of the next id (for the same ID) i need to collapse the records. See below example .....how should i write the query which will give me the desired output. i.e., get min(effdate) and max(termdate) if termdate is one day less than the effdate of next record.