How to create a new field in a view in sql server

hello

i have a view and i need a field that is not existed in none of my tables
i want to know if it is possible to create a new field in this view in sql?
this field is not a calculated or something else
it is not related to none of other fields in this view
can you help please?

in short . . yes you can. But the value of the field must be coming from somewhere right ? So where is the value of this field coming from ?

no it is just a field and then i want to import (link) this table to ms access and then enter the values manually to the form and saving them to this view

don't quite understand what you are trying to achieve with the view here. .

anyway, you can do this

CREATE VIEW your_view
AS
SELECT new_field = convert(varchar(100), NULL),
              . .  . .
FROM   . . . 

the new_field will have value of NULL

the convert is to define a data type for the column new_field

1 Like

thank you
then how i can insert data to this field to this table

1 Like

you can't. Since this is not a column of a table.

if you want to update a column of a table why not include that in the view ? ?

You can use ALTER VIEW command to create a new field in a view.

1 Like

Please learn SQL. The term "field" in SQL is part of a temporal value = {YEAR, MONTH, DAY, HOUR, MINUTE, SECOND }. A field in a file is nothing like a column in SQL!

Did you ,mean a column? And yes, you can add an expression to the SELECT list of a VIEW.

Please go away

2 Likes