is it possible to use variable for sorting?
declare @sort varchar(10)
SET @sort='column1 DESC'
SELECT ROW_NUMBER() OVER (ORDER BY @sort)AS rowId, * FROM table
Is dynamic SQL only option?
On 15/04/2010 11:28, simon wrote:
> is it possible to use variable for sorting?
> Something like:
> declare @sort varchar(10)
> SET @sort='column1 DESC'
> SELECT ROW_NUMBER() OVER (ORDER BY @sort)AS rowId, * FROM table
> Is dynamic SQL only option?
You can use CASE to he...How to Merge Date from 3 columns to 1
I have a spreadsheet where the date is spread over 3 columns I,J & K and I
wish to merge them to Column B in the format dd-mmm-yyyy as shown below.
B I J K
02-Feb-2003 02 Feb 2003
27-Mar-1999 27 Mar 1999
01-Apr-1978 Apr 1978
14-Jun-2002 14 Jun 2002
Where there is a blank for the day in 'Column I' I need it to copy as 01 and
where there is a blank for the month in 'Column J' I need it to copy as Jan.
Where all 3 column...How to sort account list?
I'm using MS Money 2004 Small Business. In the account list, my accounts
are catagorized by and in this order:
- bank accounts
- credit accounts
- investment accounts
- loans and liabilities
- asset accounts
In the above view, I cannot easily determine totals for assets and
liabilities. The following view does this.
- bank accounts
- investment accounts
- asset accounts
-loans and liabilities
How do I get the above view?
I don't use Small Business. But you can run a Net Worth report to get total
assets and ...Where's the Sort by New Message option?
Not sure when the layout of the newsgroups changed but I can't seem to find the ability to sort by new message in a thread instead of sorting by just the original thread date.
That was hugely helpful as I could follow along and see what threads were still active.
If you're gonna hang around in the newsgroups (any newsgroups), you may want to
start using a newsreader.
Microsoft Outlook Express can do it for you.
Saved from a previous post:
You may want to connect to the ms newsserver directly:
If you have Outlook Express installed, try clicking on these links (or copy and
paste i...Unhiding Column A
I am using Excel 2003 SP2 and I have a spreadsheet with column A
missing. I have followed all the Help Menu advice. I can navigate to
column A and hit Format Column Unhide or Format Column Width, but to no
It is either hidden or set to zero width, but in any case, it will NOT
show up. I have searched all the group postings, been to Microsoft.com
help (yea, right) and done everything I can think of. Even installed a
macro I found to unhide columns by macro.
Any help would be most appreciated.
try selecting the cells button to the left of the column headers and on top
o...Comparing and extracting from two columns
I have two columns of data. Column A is a list of approx. 20,000 ZIP codes, column B is a selected list of approx. 1600 ZIP codes. How can I compare the two and remove all of the entries in A except those that match B. I would also like to have A sorted so that the identical entries line up with B. There may be entries in B that are not in A, so I would like A to contain a blank cell where the match would be.
I used =IF(VLOOKUP(B1,A:A,1,FALSE),"MATCH","") to highlight the matching ZIP codes in A, but that does not remove the unwanted ZIP codes or sort them...How do I transfer data from Notepad to Excel?
I transferred a file from a database that will only save reports in Notepad.
I then, cut and paste the data into Excel. However all of the info is merged
into one cell. How can I format this data, so that it will be a simple
worksheet with more than one cell? i.e. Name, SSN, Home address should all be
in different cells
Have you tried importing the file through the Data | Import External Data |
Import Data... function? This function will allow you to import the data and
separate the fields into different cells.
> I transferred a file fr...Row/Column labels not displayed.
I'm using Excel 2002
A spreadsheet I've been given to use only displays the row/column labels
upto 73/X respectively.
I've never seen this before. Any ideas how I can set this up?
Further to my previous mail, the movement of the selected cell by using the
cursor or clickin/dragging
"Dave F." <email@example.com> wrote in message
> I'm using Excel 2002
> A spreadsheet I've been given to use only displays the row/column labels
> upto 73/X respectively.
> I've never s...Can I convert a column into a row?
Excel Question. I simply want to convert a column of figures [each in
different cells] into a row with a similar number of cells. Must be simple,
but can't seem to find how to do it. Thanks for any replies, guys!!
Select the cells in the column you want to paste in the row. copy (control
C). Select the same number of cells in a row, click Edit > Paste Special.
Select transpose. Click ok.
"Lenworth" <Lenworth@discussions.microsoft.com> wrote in message
> Excel Question. I simply want to convert ...COUNT function 2 Columns
I have two columns of data, CATEGORY and NUMBER, and want
to be able to COUNT the number instances where CATEGORY =
X and NUMBER = Y.
I know how to use the COUNT function on each column, but
I don't know how to use it on two columns.
James, how about something like this
Always backup your data before trying something new
Please post any response to the newsgroups so others can benefit from it
Feedback on answers is always appreciated!
Using Excel 2000 & 2003
** remove news from my email address to reply by ema...How to prevent ole container hwnd receive certain messages? #2
I used CSubclassWnd of Paul DiLascia to subclass(in fact use SetWindowLong
to replace WindowProc) hwnd returned from IOleWindow::GetWindow. In the
WindowProc I prevent it by
LRESULT CShellEmbedding::WindowProc(UINT msg, WPARAM wp, LPARAM lp)
if (msg == WM_WINDOWPOSCHANGING)
return CSubclassWnd::WindowProc(msg, wp, lp); // Important!!
but spy++ still tell me that hwnd of ole get the send WM_WINDOWPOSCHANGING
message and return. So Is it right way to eat message in win32 or ole
container hwnd does special things?
"Su Wei" <suwei@sina_com> wrote in message
new...Row names will not move with sort
Each row in my summary table in Sheet1 is hyperlinked to a corresponding table in Sheet2 with additional details.
I need to move the rows in my summary table (Sheet1) and preserve the links to and from the details tables (Sheet2).
I found that I can move rows in Sheet1 with cut & insert and the hyperlinks are maintained. I can travel from a row in summary table (Sheet1) to details table (Sheet2) and back, even after the corresponding row (Sheet1) was moved.
But if I sort the rows in Sheet1 the links from Sheet2 back to corresponding rows in Sheet1 lead to presorted locations. Apparen...Trendline partial data
I am trying to add a trendline to a process variable on a line-chart and use
it to predict when remedial action is required. When the data parameter is
reset, the trendline automatically takes in this new set of figures and
attaches it to the previous, giving a totally skewed analysis. Is there any
way that I can select only some of the data to trend? Then as the reset data
grows, only to select the new series from the process?
Jon Peltier has a site that mentioned about dynamic charts which I find
useful and you might want to check this out.
http://peltier...Money Plus Deluxe 2008 Can't Change Account Type
I set up a 401k account as an asset account, instead of a retirement account
in an earlier version of Money. I did it that way because that version made
it hard to manage if listed properly. I can't figure out how to change it to
a retirement account in Money Plus Deluxe 2008. It isn't an option under
Change Account Settings. However, if I look at my checking account under
Change Account Settings, there is an option to change it to a retirement
account. Why can't I change an asset account to a retirement account?
...sorts not sorting
OK- Thanks to everyones help I now i have a list i can work with... but
there are a few problems.... the zips are all 5 digit and now i have to
sort them... the problem is, THEY WONT SORT CORRECTLY!!!!!!! The
numbers are not in order... some are but a lot are not... is there
anyway to fix this???? i need to sort them by zip code but cant seem to
get them to do it correctly.. any ideas???
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/
You are going to be far better of...Aligning data with varying decimal places
I have a column of cells in which the data include various numbers of decimal
places. Is there a way to align the data vertically so that the decimals
line up, without adding trailing zeroes?
In article <DD9B0C05-0A1D-4A5A-99F4-BB8030D9F7F2@microsoft.com>,
edpaul <firstname.lastname@example.org> wrote:
> I have a column of cells in which the data include various numbers of decimal
> places. Is there a way to align the data vertically so that the decimals
> line up, without adding trailing zeroes?
...import- number- sort?
I imported this data into a spread sheet- I tried to format it to number,
but when I sort it- I get :
Whats up with this?
Install the TrimAll macro, select the column and invoke
the macro from Alt+F8
Directions to install and use a macro at
I expect that you have spaces or CHAR(128) "Required Blank"
characters in you data you can check is =LEN(A1)
David...Representing Dual Data in a Stacked Bar Chart
Here is my data:
Location Flowers Trees
Year 1 Year 2 Year 1 Year 2
Texas 55 63 36 14
Florida 67 75 24 21
NJ 32 27 52 10
Colorado 35 41 35 9
California 84 126 78 39
I want a stacked bar chart that shows Flowers & Trees for Year 1 next to
another stacked bar for Year 2, grouped by location shown along the X axis.
Please help, all I could come up with is a Stacked bar for Year 1, overlayed
by 2 separate line graphs for Flowers/Yr2 and Trees/Yr2.
On Wed, 20 Jun 2007, in microsoft.public.excel.charting,
VB <VB@discussions.microsoft.com> said:
>I want...sorting macro #3
I need to sort on 8 cells in a row and on 1500+rows. I can do it one at a
time but I know there must be an easier way. Can ANYONE HELP?
C3:J3 I need these cells sorted and then down to C1532:J1532
I did create a macro to sort after I selected them but still one at a time.
Does it have to be a macro? I can edit a macro but don't really know how to
Yes, it has to be a macro. The following should do it. This macro loops
through all the entries in Column C, and in each row it sorts the values in
Columns C:J. HTH Otto
Dim rColC As Range
Dim i As...Contacts on Delgate computer are different than Mine
So I have a delegate that is an Editor to my mailbox. She takes care
of all my contacts. However the contacts that she has for my mailbox
on her outlook do not match what is in my mailbox - contacts on my pc?
How are they different? Maybe she's not seeing some that you've marked as
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
"DMobley232" <email@example.com> wrote in message
news:3abd1c74-3744-4b88-8ae0-fc...Can we sort a form and also be able to enter new records.
It is possible to sort the data on a form and also be able to enter
new and edit the existing records in it.
On Tue, 15 Jan 2008 15:41:16 -0800 (PST), Rex wrote:
> It is possible to sort the data on a form and also be able to enter
> new and edit the existing records in it.
I assume you mean "Is it".
The form sort order has nothing to do with editing or adding new
records, so the answer is yes.
If you cannot edit or add new records, make sure the form's record
source, if it is a query, is updateable. Some queries are not.
O...Auto-entering data from another sheet
Hopefully someone can help me.
I am wanting to automatically enter data from one sheet into the next
by a text prompt. For example:
On sheet 2 I will have 3 static columns that will have data entered in
the format: text / text / number respectively.
On sheet one I want to be able to enter the text from the first column
on sheet two and have excel automatically fill in 2 other cells with
the data from cell B and C from sheet 2.
Sheet 2 contains hello / how / 123 in row 1 and column A,B,C.
I enter: hello (on sheet 1 cell A) and in cell B and C I automatically
get...Sorting checking register
How do i sort my check register in Money 2004 Deluxe so
that uncleared transactions appear below cleared
transactions? In Quicken i could click on the column to
provide that sort.
In microsoft.public.money, Dean wrote:
>How do i sort my check register in Money 2004 Deluxe so
>that uncleared transactions appear below cleared
>transactions? In Quicken i could click on the column to
>provide that sort.
You don't. Available choices are chosen by clicking View at the top
of the register.
...Getting Data out of MS CRM
What is the best way to get all the data out of MS CRM in order to
migrate it to another CRM system? Woud the Data Migration tool work
for this? I've never used it.
If you want all the data, and all the customisations, the best option is to
use SQL backup and restore, and the CRM redeployment tool against the
Using the Data Migration tool will be hard work for this, and has some
noticeable limitations, such as it can't be used for custom entities
> What is the best way to get all the data out of MS CRM in order to
> migrate...using addrress books to sort incoming mail
I use address books to sort incoming mail.
An odd thing: depending on how the sender's name comes across, it doesn't
get caught by the filter (amd moved to the "Family Mail" Folder I have set
up. for example: my mom and dad's email (from firstname.lastname@example.org)
comes as from that address. However, in my contacts, they are listed by
their names: John and Mary Smith, with email@example.com as their
email address and John and Mary Smith as the display name.
What have I done wrong?
1. The big ONE - failed to post your version of Outlook. Rules operate at