Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

tsql computed function not responding with huge record

Posted on 2012-12-25
4
Medium Priority
?
489 Views
Last Modified: 2012-12-25
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 ?
0
Comment
Question by:afifosh
  • 2
  • 2
4 Comments
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 2000 total points
ID: 38720150
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.
0
 
LVL 1

Author Comment

by:afifosh
ID: 38720171
your function is better but the problem when i putted as computed column give same problem :S UPPER(left(datename(WEEKDAY, datetimein),2))
0
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 38720172
did you try to save the change script, and run it from T-SQL windows instead from table's design view?
0
 
LVL 1

Author Comment

by:afifosh
ID: 38720182
THANK YOU :d
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article we will learn how to fix  “Cannot install SQL Server 2014 Service Pack 2: Unable to install windows installer msi file” error ?
An alternative to the "For XML" way of pivoting and concatenating result sets into strings, and an easy introduction to "common table expressions" (CTEs). Being someone who is always looking for alternatives to "work your data", I came across this …
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
Via a live example, show how to setup several different housekeeping processes for a SQL Server.

971 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question