Sorting Capability On A Column
Jan 27, 2014I need to sort on a column that has a mix of alpha/numeric...
oActual Sort: A1, A100, A14, A2, A222, A25 …
oFavored Sort: A1, A14, A100, A2, A25, A222 …
I need to sort on a column that has a mix of alpha/numeric...
oActual Sort: A1, A100, A14, A2, A222, A25 …
oFavored Sort: A1, A14, A100, A2, A25, A222 …
Hi all,
i have this column name "Effective Date". the data inside it is like this:
01-Aug-2006
01-Jan-2007
01-Jun-2006
01-Mar-2004
01-Nov-2003
01-Oct-2005
02-Oct-2007
05-May-2006
08-Oct-2003
1-Agustus-2005
10-Feb-2002
10-Jan-2005
10-Mar-2003
11-Feb-2008
12-Dec-2006
12-May-2008
14-Nov-2006
15-Jun-2004
19-Jun-2007
22-Mar-2007
23-Apr-2007
23-Jan-2008
26-Feb-2008
27-Jan-2005
27-Mar-2007
27-Sep-2007
How to sort the column? i've using Order by [Effective Date], but it doesnt work.
please help.
thanks,
Addin
I have the column of type string in the database
Following is the data in that column
1
2
11
12
21
abc
If i sort the table with the help of this column then the output come in the following manner
1
11
12
2
21
abc
can i improve the order actually i want the output like 1 2 11 12 21 abc
We've just installed SQL Server 2000 on one of our servers and havenoticed a strange behavior. When clicking the column headings in thejob display in Enterprise Manager, the list is sorted (first clickascending, then descending) on the column clicked except for "Next RunDate." When we click on "Next Run Date," the list is reordered, butrandomly. Each time we click it we get a different order but neverascending or descending. This is true whether we're at the server oron a remote machine. We never saw this behavior with SQL Server 7.0.Any ideas? Thanks!
View 4 Replies View RelatedHi, I have a table whose Identifying column is not an integer but rather a manually entered id. (i.e. 106F, 106-09, G11 etc.) When sorted ascending, a G11 will come before a G2 in the list, 106-11 before 106-2, etc.I would like to insert a new column in the database or use some kind of function when sorting the database to ensure that the list in returned in the proper order. Any ideas?Much appreciated...
View 16 Replies View RelatedI have a matrix with the rows consisting of customers and the columns consisting of different revenue streams. The revenue streams are totalled using the matrix subtotal feature. I would like to sort, either interactively or statically (if that is the only option) by the subtotal column. I've read through everything I can find online and even the solutions that appear to be appropriate do not work. Can anyone give me a suggestion?
Thanks,
Zack Gallinger
can anyone please help on a sql statement that would sort out three kinds of data. let's say i have a column that contains a status flag. there are only 2 possible values, add and delete. now, i want to sort out three kinds of data: add_only, delete_only, and update. Update is the data that contains duplicate records in the table. Which means, there are two rows having same "student_number" but two different status flags. This happens when there's an update or change in data, such as new address or new phone number. The old row/data is sent with status flag of delete, while the updated data is sent with status flag of add. Example below. An output table with a new column of tag is created.
reports table
STUDENT_NO
NAME
ADDRESS
PHONE
STATUS FLAG
1
McKenzie
Ohio
9111111
add
2
Hario
New Jersey
1234567
add
3
Oda
Japan
9876543
delete
4
Davis
Chicago
1112222
add
5
Rodriguez
Detroit
4445555
add
1
McKenzie
Ohio
7778888
delete
4
Davis
Detroit
1112222
delete
create, remove, update table
STUDENT_NO
NAME
ADDRESS
PHONE
STATUS FLAG
TAG
2
Hario
New Jersey
1234567
add
create
5
Rodriguez
Detroit
4445555
add
create
3
Oda
Japan
9876543
delete
remove
1
McKenzie
Ohio
9111111
add
update
4
Davis
Chicago
1112222
add
update
Anyone knows what SQL statements to use to have this output? Thanks.
Hi
I have Constructed a table
Table Name : MasterEntry
Column Name:
MasterEntryNumber
ServiceName
ServiceDepartment
EmployeeName
MasterEntryNumber is GenerationNumber where ever any entry is happen in table
if put a queries [select * From masterentry Order by MasterentryNumber] is give output in ascending order
e.g MasterEntryNumber has
1
2
3 it give correct ordering
but if i exceed more 10 if i put same queries
Output of queries is
1
10
11
2
3 this is the out of the queries if it exceed more 10 rows
i want queries should be look like this
1
2
3
...... 10
did any have experience on this issue please let me know where i can fix
kinds regards
I am trying to sort this simplied table:
ID - Time
1 2000-2001
2 2002-
3 2001-2003
4 1999
5 2005-2006
I want this as a result:
1999
2000-2001
2001-2003
2005-2006
2002-
Because the "-" means "continues", it the thing is still activated, so if it makes it easier, i could put the today's year afterwards during the query, if it ends with a - ...
Now, simply doing a
SELECT * FROM [table] ORDER BY TIME;
Sorts it "perfectly", apart from the "2002-" is just placed before 2005 and after 2001.
So, of course, it fails on all entries with a leading "-" ...
Right when I clicked "submit", of course, I can simply replace all entries with a time ending with "-", with the todays Year, so at least they will get at the end of the query...
Well, have to do a union, first sorting all without the "-", then sorting all with the "-", and that should be it...
Hi All,
I want to sort the column data which is of positive and negative number like the following.
-5823
-1
200
100
i want to sort like
-1
100
200
-5823
How can i do that can any one help me..
Thanks in advance.
-john
Hi All,
Is there any command which will sort data in text file based on 3rd column (based on any column)?
Thanks
Sanjeev
Hello,
I have data coming in from two sources, one being SQL and the other being Oracle. The end result needs to be a CSV file with the columns in a specific order. I have a Data Flow task setup that takes both sources and does a Merge Join on them. I can add a Sort Transformation and manually set the sorting of all 156 columns that end up going to a CSV file destination. However, I have a table setup that holds the names of the 156 columns and the order that the CSV file expects them to be in. I would much rather do this step dynamically as the column names and order may change in the future. Anyone who has used the Sort Transformation for a large number of columns knows how tedious it can be and how adding a column in the middle will cause you to change the sort # for each of the columns that come after it.
So I added a Script Component between the Merge Join and the Flat File Destination hoping that I could alter the order of the columns there. However I added the following code and found that the SortKeyPosition is ReadOnly.
Public Overrides Sub Input0_ProcessInputRow(ByVal Row As Input0Buffer)
Dim column As IDTSInputColumn90
For Each column In Me.ComponentMetaData.InputCollection(0).InputColumnCollection
column.SortKeyPosition = 1
Next
End Sub
I was hoping to add some code to get the sort index from my table for each of the columns and set it to the SortKeyPosition. Has anyone out there done this before or seen an example that might point me in the right direction? I've searched for 2 days without coming up with much.
Thanks!
Hi,
I have a matrix report...the column results
are as follows
Con Std , Con Access, SF Std, SF Acc, Broadband, Pay TV
how would i make the columns appear in the above order when displaying as it is default alphetically sorted...I have tried putting numbers at the front which work till I get to the number 10 which alphetically sorted is next to 1 not 9?
is there a better way off sorting matrix column which have no specific criteria to sort from?
thanks
I am creating a Matrix report using SSRS/Visual Studio 2008 as below:
Jan
Feb
March
April
May
June
July
Aug
Sept
Oct
A & B are customers. The values represent sales for each month.I have got most parts in place except the Month are displayed in random order (1,10,2,3,4,5,6 and so on).I have tried the option to create a calculated column with month numbers and change group properties but that did not work.how to get it to sort display as 1,2,3,4,5,6,7,8,9,10.
I am having problem with the unpivot function of sql 2012, i unpivot my column then i get the result that i wanted but the error that i was encountering was the unpivot is automatically sort the column in alphabetically order which is not I desire,
Here is my code
@syear nvarchar(50)
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
[Code] ....
I have a tablix that looks like this...
30 Jul
31 Jul
01 Aug
02 Aug
03 Aug
04 Aug
05 Aug
Region1
0.00
0.00
0.00
0.00
100.00
100.00
0.00
[code]....
I would like to sort the last column which is a dynamic date (always the most recent from the last 7 days) from 0 to 100.
I have a report where I am giving the users a parameter so that they can select which field they would like to sort on.The report is also grouping by that field. I have a gruping section, where i have added code to group on the field I want based on this parameter, however I also would like to changing the sorting order but I checked around and I did not find any info.
So here is my example. I am showing sales order info.The user can sort and group by SalesPerson or Customer. Right now, I have code on my dataset to sort by SalesPerson Code and Order No.So far the grouping workds, however the sorting does not.
Any suggestions would help.
Thanks
SSRS 2012 - VS2010...The report compares two years with a sort order on a value that has been engineered based on text switched to int. When sorting A-Z this is the result in the horizontal axis is: 5th, K, 1st, 2nd, 3rd, 4th, 5th..When sorting Z-A the result in the horizontal axis is:5th, 4th, 3rd, 2nd, 1st, PreK..Z-A is correct but A-Z sorting shows 5th as the start and end. The magnitude of the PreK location is correct but the label is wrong on the A-Z sort order. The sorting is implemented using the Category Group sorting option.
View 6 Replies View RelatedI am trying to sort my sql resultset by an alphanumeric column of a table which is of NVARCHAR datatype. The sample data is given below:
CREATE TABLE #Activities(activityName NVARCHAR(100))
INSERT INTO #Activities VALUES('Field phase S14-04932-01')
INSERT INTO #Activities VALUES('Phase reporting')
INSERT INTO #Activities VALUES('Phase running')
INSERT INTO #Activities VALUES('RD1')
[Code] ....
The output of the query is like this:
A1
A2
A3
A4
E1 0DAA1
E10
E2 0DAA2
[Code] .....
The output what I require is this:
A1
A2
A3
A4
E1 0DAA1
E2 0DAA2
[Code] ....
Hello, I am trying to achieve a query results with not much luck. I am struggling the query design of how to construct to get the right results.
My table has the following data
RoomID Subject StartDate Duration(min) EndDate
201 test 28/09/2007 07:00:00 180 28/09/2007 10:00:00
202 test 28/09/2007 09:00:00 240 28/09/2007 13:00:00
The best way to describe is a scheduling system with the StartDate, Duration, EndDate.
I am trying to query for datetime periods which are allocated, eg the table records show from 7am - 10am and 9am - 1pm are allocated.
When I query on StartDate >= 28/09/2007 07:00:00 AND EndDate <= 28/09/2007 13:00:00, record 201 & 202 shows which is correct because they are within query parameters and are allocated.
When I query on StartDate >= 28/09/2007 07:30:00 AND EndDate <= 28/09/2007 13:00:00, record 202 only shows which is correct because record 201 StartDate is before 07:00:00.
But my problem is I require record 201 to show because the time period between 07:00:00 and 09:00:00 is allocated and the query parameter is 07:30:00 which is still between 07:00:00 and 09:00:00.
I have researched where on similar situations, the use of duration is used, but I am unsure on its application to achieve results.
I have also read of other situations where a lookup table should be used, but again I cannot get my head around the application of a lookup table to query the resuults.
Does anyone have any theories, design thoughts or real work solutions they can help me with.
Thanks
Peter Smith
Is there a restartability and ability to skip x number of rows (Restart Logic) in SSIS?
can ssis allow rollback for unsuccessful completion of load process by record????
Pls give me example
Has anyone heard as to whether Microsoft plans on updating the charting engine for Reporting Services? Right now I find the charting capability rather limited and would like to see richer charting capability. Is this a case where it is better to not wait for this feature as it will be way off into the future before this happens, or better charting features just are not in the scope of Microsoft's plans for Reporting Services. If either case is true then the best solution would be to purchase the full capabilities of Dundas Chart for Reporting Services.
View 1 Replies View RelatedHow to build a powerful search capability in SQL Server 2005?TIA
View 2 Replies View RelatedHello, I am trying to achieve a query results with not much luck. I am struggling the query design of how to construct to get the right results.
My table has the following data
RoomID Subject StartDate Duration(min) EndDate
201 test 28/09/2007 07:00:00 180 28/09/2007 10:00:00
202 test 28/09/2007 09:00:00 240 28/09/2007 13:00:00
The best way to describe is a scheduling system with the StartDate, Duration, EndDate.
I am trying to query for datetime periods which are allocated, eg the table records show from 7am - 10am and 9am - 1pm are allocated.
When I query on StartDate >= 28/09/2007 07:00:00 AND EndDate <= 28/09/2007 13:00:00, record 201 & 202 shows which is correct because they are within query parameters and are allocated.
When I query on StartDate >= 28/09/2007 07:30:00 AND EndDate <= 28/09/2007 13:00:00, record 202 only shows which is correct because record 201 StartDate is before 07:00:00.
But my problem is I require record 201 to show because the time period between 07:00:00 and 09:00:00 is allocated and the query parameter is 07:30:00 which is still between 07:00:00 and 09:00:00.
I have researched where on similar situations, the use of duration is used, but I am unsure on its application to achieve results.
I have also read of other situations where a lookup table should be used, but again I cannot get my head around the application of alookup table to query the resuults.
Does anyone have any theories, design thoughts or real work solutions they can help me with.
Thanks
Peter Smith
I have a MS SQL database that is used with my Web site. I want to enable simple search capability where one or more words could be entered in a text box and have it search certain columns in my database for occurrences of those words. I've never done this before and so I'm not sure how to get started. Can someone help me begin? Thanks!
View 1 Replies View RelatedI am working on creating charts in Windows Application, client-side report development, and the user requires to have a zoom capability on the chart area. For example zoom a piece of chart as selected by the user and then zoom out. Does anyone know that how can it be achieved?
Thanks a lot in advance.
I have a matrix report with 2 column SaleAmount and ProfitAmounts by Month like
Sale Profit
Dealer 5/1/2007 6/1/2007 7/1/2007 5/1/2007 6/1/2007 7/1/2007
A 100 200 300 20 25 15
B 200 250 50 30 45 19
how can i do following 3 things
1)Add Total column for Sale and Average column for Profit
2)Sort report by lastMonth of Sale (here 7/1/2007) High to low
3)if last month of sale(here 7/1/2007) is less than second last month here (6/1/2007) whole row should be red
thanks
We are thinking of deploying MSDE for a modest traffic Intranet. According to this http://www.microsoft.com/sql/msde/howtobuy/msdeuse.asp 25 concurrent users should be fine.
What exception would we get if the MSDE was not handling the traffic?
What would be the best way to track/log how close we are getting to the 25 user max.
Thanks
Simon
I am looking for a solution to allow users to generate data by selecting tables-->columns-->where clauses on the fly.
I am thinking to maintain relationships, joins, etc., in some configuration tables. Based on the fields selected by the user, I can get these conditions and generate a query, execute and export to excel. Any ideas what is the good way of storing relationships, etc. in configuration table?
Also suggest if there is any good excel add-in to do adhoc reporting. Point me if there is any other ways of doing.
If I have to do it from scratch, i probably use VB.NET.
Any ideas, information is appreciated. thanks
1) How can I keep my package from running more thatn 1 instance at a time?
I tried changing "MAXCONCURRENT" to "1" in my DTEXEC command in batch file, however, this doesn't limit the # of instances. (If I run the batch file twice, one after the next, I get 2 instances running simultaneously).
2) What "executable files" is this definition referring to?
MAXCONCURRENT is defined as:
"Specifies the number of executable files that the package can run concurrently. The value specified must be either a non-negative integer, or -1. A value of -1 means that SSIS will allow a maximum number of concurrently running executables that is equal to the total number of processors on the computer executing the package, plus two."
Thx,
Mojo
I am trying to save my package (using MS Visual Studio) with ProtectionLevel = ServerStorage but it is failing with the following error "failed to apply package protection with error 0xC0014061, the protection level, serverstorage, cannot be used when saving to this destination. The system could not verify that the destination supports secure storage capability...". I am trying to test a scenario on which the package is saved in SQL Server/msdb and schedule the package via SQL Job Agent. Can someone show me how to save a package using serverstorage and schedule it via SQL Job Agent?
View 4 Replies View RelatedOk this is what I have
$query = $query = "SELECT date, file name FROM comment WHERE file name ='', AND CorS='C', AND Approved='Y', ORDER BY file name DESC";
But what I want is to return all results based on the file name from the most recent to the oldest. Can anyone help????
hi,
i need a query based on sorting.
i have date column and time as varchar in another column and other order details
datecol timcol ordername type
12/31/2007 1:00 pm order1 1
12/31/2007 5:00 pm order2 1
12/22/2007 6:00 pm order3 1
so i need to get query o/p as
12/22/2007 6:00pm
12/31/2007 1:00 pm
12/31/2007 5:00pm
based on date and time. pls help!