Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Hopefully an Easy Question

Author  Topic 

byeskey
Starting Member

5 Posts

Posted - 2007-03-01 : 10:28:37
I'm creating a report from my table and I would like to take the last name field and only display the first two characters. I can't find out how to do that.

Any ideas?

nr
SQLTeam MVY

12543 Posts

Posted - 2007-03-01 : 10:39:23
left(lastname,2)


==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

byeskey
Starting Member

5 Posts

Posted - 2007-03-01 : 10:48:00
So how would that be entered into a sql statement?

Select *, left(lastname,2)
From MyTable
Where dateofcreation > '02/28/06'
Go to Top of Page

nr
SQLTeam MVY

12543 Posts

Posted - 2007-03-01 : 10:54:47
yep

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page
   

- Advertisement -