Showing posts with label function. Show all posts
Showing posts with label function. Show all posts

Friday, March 30, 2012

Migrating from Acess 2003 to Sql server - Function Val()

Hi folks

I do a lot of work with address data. I have been using Acess 2003 as my database but now need to upgrade to SQL Server.

My queries have been making extensive use of the Val function to order my queries on address columns. A typical address column might be:

12 The Avenue .......

by using Order By Val(AddressCol) I can sort these rows in ascending house number.

I can't find anything in SQL Server that will acomplish this. Does anybody have any ideas.

Thanks

Paul

why do you need to reference the val() function? is there something in your column that you want to exclude?

Does: "order by AddressCol" in TSQL not accomplish what you want?

Monday, March 12, 2012

MID() function with SQL

Hello,

I need to select, from a sql database, data from a field and use something like I do in MsAccess: "SELECT field1 FROM table WHERE mid(field1, 5, 3) = 'abc' ".

Is it possible?

Tks

RuiA

Use SUBSTRING function:

SELECT field1 FROM table WHERE substring(field1, 5, 3) = 'abc'

or you could use LIKE operator

SELECT field1 FROM table WHERE field1 LIKE '__abc%'

|||

Hello Mike

Now, I think I was lazy, this one was easy!!

Thank you very much!!!

RuiA

MID function in SQL?

My brain is not working this morning. Is there a replacement for the MID
function to be used in SQL statements, or even SQL Triggers for that matter?My bad, wrong forum....found it anyway. SUBSTRING()
"Michael C" wrote:
> My brain is not working this morning. Is there a replacement for the MID
> function to be used in SQL statements, or even SQL Triggers for that matter?