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.
| Author |
Topic |
|
subhaoviya
Posting Yak Master
135 Posts |
Posted - 2012-07-23 : 04:53:33
|
| I am having table with Firstname, Lastname, Firstnamelength, lastnamelength columns.at a time lakhs of records will gets updated or inserted in the table. at present for getting Firstnamelength, lastnamelength column values we doing the process in Stored procedure like Update t1set Firstnamelength=LEN(Firstname),lastnamelength =len(Lastname).is we have these two columns as computed column, instead of having one extra update statement in SP. is that gives better performanece? |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2012-07-23 : 05:42:39
|
I would not store these values in the table.I would get the data always using LEN() when it is needed in a SELECT. No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
subhaoviya
Posting Yak Master
135 Posts |
Posted - 2012-07-23 : 08:48:26
|
| we need that for reporting purpose, that's what |
 |
|
|
Transact Charlie
Master Smack Fu Yak Hacker
3451 Posts |
Posted - 2012-07-23 : 09:26:15
|
It's not a good idea.If you have to derive the length of the names when you parse the results in the calling app.Or, wrap the table in a view which calculates the length of the strings...You are asking the db to do something extra than just return the data, something that your application layer could do very easily...Transact CharlieMsg 3903.. The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION. http://nosqlsolution.blogspot.co.uk/ |
 |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2012-07-23 : 09:38:49
|
quote: Originally posted by subhaoviya we need that for reporting purpose, that's what
Every report is based on a SELECT and there you can do your LEN() stuff... No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
|
|
|
|
|