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
 Populating cell based on SELECT statement

Author  Topic 

Johnph
Posting Yak Master

103 Posts

Posted - 2012-08-10 : 13:01:13
Hi, I am looking to populate a cell based on a select clause for example I have a table:

FIRSTNAME
LASTNAME
ADDRESS
ZIP
FIRSTLETTEROFFIRSTNAME

I want the column FIRSTLETTEROFFIRSTNAME to autopopulate based on the first letter of the FIRSTNAME column. So if someone enters Joe as the first name, FIRSTLETTEROFFIRSTNAME will autopopulate with the letter "J"


chadmat
The Chadinator

1974 Posts

Posted - 2012-08-10 : 13:07:07
Do a calculated column with Substring(FirstName, 1, 1)


-Chad
Go to Top of Page

xhostx
Constraint Violating Yak Guru

277 Posts

Posted - 2012-08-10 : 13:14:35
also this can be done during the insert statement.

--------------------------
Joins are what RDBMS's do for a living
Go to Top of Page

Johnph
Posting Yak Master

103 Posts

Posted - 2012-08-10 : 13:39:37
Works greats, thanks chadmat
Go to Top of Page
   

- Advertisement -