樓上查詢是 getdate(),也就是今天,當然會返回星期一。 改為: use temp go select datename(weekday,student表中的時間字段) as "xingqi" from student go
我改了以后,执行提示错误:从字符串转换为 datetime 时发生语法错误。 我改用SQL里的数据库Northwind也是一样。 use Northwind go select datename(weekday,'BirthDate') as "xingqi" from Employees go 这是怎么回事
use Northwind go select datename(weekday,BirthDate) as "xingqi" from Employees go去掉单引号后试试。
GETDATE
按 datetime 值的 Microsoft® SQL Server™ 标准内部格式返回当前系统日期和时间。
改為:
use temp
go
select datename(weekday,student表中的時間字段) as "xingqi"
from student
go
我改用SQL里的数据库Northwind也是一样。
use Northwind
go
select datename(weekday,'BirthDate') as "xingqi"
from Employees
go
这是怎么回事
go
select datename(weekday,BirthDate) as "xingqi"
from Employees
go去掉单引号后试试。