Questions tagged [persisted-column]

19 questions
0
votes
2 answers

In a persisted field, how do you return the number of occurrences of a column within a different table's column

The following is required due to records being entered by 3rd parties in a web application. Certain columns (such as Category) require validation including the one below. I have a table OtherTable with the allowed values. I need to identify how…
aSystemOverload
  • 2,994
  • 18
  • 49
  • 73
-1
votes
1 answer

Changing all computed columns to persisted

I have the following query to check which columns of my database are computed and not persisted select t.name, c.name from sys.tables t inner join sys.computed_columns c on c.object_id = t.object_id where c.is_persisted = 0 Is there any easy query…
Nizam
  • 4,569
  • 3
  • 43
  • 60
-1
votes
1 answer

Why is this Persisted field not calculating correctly - [FIELDA]='%BUILD%'

I have a persisted field in SQL Server 2008. (case when [FIELDA]='%BUILD%' then CONVERT([bit],(1),(0)) else CONVERT([bit],(0),(0)) end) FIELDA can contain 'LARGEBUILDING' , 'BUILDING', 'BUILDING MAJOR'm, so BUILDING can be anywhere in the…
aSystemOverload
  • 2,994
  • 18
  • 49
  • 73
-2
votes
2 answers

How can you format a persisted column as a padded integer string [SQL Server 2008]

What formula would I use in a persisted column so that I can add the two columns below together, the first must be padded to 5 characters: ID (INT) RefNum (STRING) I went for format(ID,"00000") & RefNum, but it doesn't work, any ideas please?
aSystemOverload
  • 2,994
  • 18
  • 49
  • 73
1
2