SQL 添加具有默认值的列 - Access 2003 [英] SQL to add column with default value - Access 2003

查看:24
本文介绍了SQL 添加具有默认值的列 - Access 2003的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为客户端更新旧的 ASP/Access 站点 - 我需要 SQL 将一列添加到现有表并设置默认值.不起作用 - 有什么想法吗?

Updating an old ASP/Access site for a client - I need SQL to add a column to an existing table and set a default value. Doesn't work - any ideas?

这很好用

ALTER TABLE documents ADD COLUMN membersOnly NUMBER

我希望它起作用:

ALTER TABLE documents ADD COLUMN membersOnly NUMBER DEFAULT 0

在谷歌上搜索并查看了适用于其他字段类型的默认值说明,但我想添加数字.谢谢!

Have googled and seen instructions for default values work for other field types but I want to add number. Thanks!

推荐答案

工具 ->选项 ->表/查询 ->(在右下角:) Sql Server Compatible Syntax - 为这个数据库打开选项.

Tools -> Options -> Tables/Queries -> (At the bottom right:) Sql Server Compatible Syntax - turn option on for this database.

然后你可以执行你的查询:

then you can execute your query:

ALTER TABLE documents ADD COLUMN membersOnly NUMBER DEFAULT 0

这篇关于SQL 添加具有默认值的列 - Access 2003的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆