I have a computed column created with the following line:
alter table tbPedidos
add restricoes as (cast(case when restricaoLicenca = 1 or restricaoLote = 1
Another thing that might be helpful to someone is how to modify a function that's a calculated column in a table (Following query is for SQL):
ALTER
DROP COLUMN
ALTER FUNCTION
(
)
RETURNS
BEGIN
...
END
ALTER
ADD as dbo.(parameters)
Notes:
Parameters can be other columns from the table
You may not be able to run all these queries at once, I had trouble with this. Run them one at a time
- SQL automatically populates calculated columns, so dropping and adding won't affect data (I was unaware of this)
- 热议问题