| Author |
Topic |
|
HWebster
Starting Member
4 Posts |
Posted - 2011-11-28 : 08:28:01
|
Hi,I am fairly new to SQL and I'm trying to convert nvarchar to numbers where the nvarchar is a single letter.Can anyone help me please?Thanks in anticipation HWebster |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2011-11-28 : 08:31:09
|
| Can you post some sample data? How will you convert letter to number?MadhivananFailing to plan is Planning to fail |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-11-28 : 08:34:09
|
quote: Originally posted by HWebster Hi,I am fairly new to SQL and I'm trying to convert nvarchar to numbers where the nvarchar is a single letter.Can anyone help me please?Thanks in anticipation HWebster
single letter? you mean numeric data or character data?------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
HWebster
Starting Member
4 Posts |
Posted - 2011-11-28 : 10:39:27
|
| Hi,The table has several entries per person for various elements, each with a grade A-D. I am trying to select only the lowest grade for each person, in Report Builder and I remember someone telling me this was how to do it, but I can't remember how.The table is as follows:Name - float Date - unsure Grade - nvarcharElement - nvarchar If someone had one A and one D, I only want to select the D entry.Sorry if I'm not explaining this well, as I said, it is all new to me, I do know what I'm doing but can't always articulate what I want to do in the proper way! Many thanks. |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-11-28 : 10:45:04
|
quote: Originally posted by HWebster Hi,The table has several entries per person for various elements, each with a grade A-D. I am trying to select only the lowest grade for each person, in Report Builder and I remember someone telling me this was how to do it, but I can't remember how.The table is as follows:Name - float Date - unsure Grade - nvarcharElement - nvarchar If someone had one A and one D, I only want to select the D entry.Sorry if I'm not explaining this well, as I said, it is all new to me, I do know what I'm doing but can't always articulate what I want to do in the proper way! Many thanks.
ok. what has this to do with conversion you asked?------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
HWebster
Starting Member
4 Posts |
Posted - 2011-11-28 : 11:00:33
|
| Hi,My former colleague told me that to select the lowest grade I would need to convert to number then select min. Therefore, I would need to convert data in the Grade column to a number, unless there is another way to do this.Many thanks. |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-11-28 : 11:04:42
|
| ok. for that what you need is a case statement likeCASE Grade WHEN 'A' THEN 4WHEN 'B' THEN 3WHEN 'C' THEN 2WHEN 'D' THEN 1END------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
HWebster
Starting Member
4 Posts |
Posted - 2011-11-28 : 12:29:00
|
| Thanks very much! |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-11-28 : 12:40:01
|
| wc------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|