tsql computed function not responding with huge record

AFIF JABADO
AFIF JABADO used Ask the Experts™
on
i have create new column and i have add this function

CASE DATEPART(WEEKDAY,datetimein)  WHEN 1 THEN 'SU' WHEN 2 THEN 'MO' WHEN 3 THEN 'TU' WHEN 4 THEN 'WE' WHEN 5 THEN 'TH' WHEN 6 THEN 'FR' WHEN 7 THEN 'SA' END 

Open in new window


and i got this message

- Unable to modify table.   Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding.

every time i get new record on this table who i can solve it ?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Billing Engineer
Most Valuable Expert 2014
Top Expert 2009
Commented:
first, you could simplify the formula like this:
ucase(left(datename(wk, datetimein),2))

anyhow, for large table(s), the GUI will give you eventually a timeout.
running the t-sql directly will run without timeout, as long as needed.

Author

Commented:
your function is better but the problem when i putted as computed column give same problem :S UPPER(left(datename(WEEKDAY, datetimein),2))
Guy Hengel [angelIII / a3]Billing Engineer
Most Valuable Expert 2014
Top Expert 2009

Commented:
did you try to save the change script, and run it from T-SQL windows instead from table's design view?

Author

Commented:
THANK YOU :d

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial