I currently have a table in SQL Server called masterTable
. What I'd like to do is to add a new column to this table called report_Date
.
I would like to store the results of a SELECT
query in the report_Date
column. The query works fine (it converts a nvarchar
into a desired date format). What I can't do is append the results to the column.
My query:
SELECT
CONVERT(varchar(10), CAST(FileName AS date), 103) AS FileName
FROM dbo.masterTable
Any suggestions please?
CodePudding user response:
If I understand your question correctly then
UPDATE dbo.masterTable SET
report_Date = CONVERT(varchar(10), CAST(FileName as date), 103)