在 SQL 中将整列更改为日期类型
我正在尝试将列的数据类型cresence_date
转换为日期类型,但无法执行此操作,该列是varchar type和ser_muhammad_mallick.user的列。 IAM使用以下代码段。
SELECT CONVERT (datetime, Confirmation_Date , 104) FROM USER_MUHAMMAD_MALLICK.user_upsells;
运行此代码时,我将收到以下错误消息
SQL Error [42000]: syntax error, unexpected IDENTIFIER_LIST_ [line 1, column 17] (Session: 1729360210797461536)
I am trying to convert the datatype of a column Confirmation_Date
to date type but unable to to do so, the Column is of varchar type and SER_MUHAMMAD_MALLICK.user is the tablel. Iam using the following code snippet.
SELECT CONVERT (datetime, Confirmation_Date , 104) FROM USER_MUHAMMAD_MALLICK.user_upsells;
I am receiving the following error message when I run this code
SQL Error [42000]: syntax error, unexpected IDENTIFIER_LIST_ [line 1, column 17] (Session: 1729360210797461536)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用 Alter Table Modify column 。例如,将
varchar
列转换为date
:请注意,varchar值必须是正确的日期格式。如果您有不同的日期格式,则需要指定
nls_date_format
session参数, Alter Session :You can use alter table modify column. For example to convert a
VARCHAR
column toDATE
:Note that the varchar values must be of the correct date format. If you have a different date format you need to specify the
NLS_DATE_FORMAT
session parameter with ALTER SESSION: