我用asp写下面这个sql语句,对access访问是可以通过的但对sql server不行,请指教!
strBusi="select user.userid,email,companyname,Industrytype, Industryclass,type,hot,title,content,keyword,msgdate,linkUrl "_
& " From User , Business, IndustryType, IndustryClass Where messageid="&Request.QueryString("messageid") _
& " and user.IndustryTypeid=IndustryType.IndustryTypeid and user.IndustryTypeid=industryclass.IndustryTypeid and user.industryclassid=industryclass.industryclassid" _
& " and user.userid=business.userid"
请问应该怎么改,急~~~~
问题点数:100、回复次数:6Top
1 楼saucer(思归)回复于 2003-09-02 06:33:10 得分 50
"user" is a system-supplied value in SQL Server, use [user] or rename the table
strBusi="select [user].userid,email,companyname,Industrytype, Industryclass,type,hot,title,content,keyword,msgdate,linkUrl "_
& " From [User] , Business, IndustryType, IndustryClass Where messageid="&Request.QueryString("messageid") _
& " and [user].IndustryTypeid=IndustryType.IndustryTypeid and [user].IndustryTypeid=industryclass.IndustryTypeid and [user].industryclassid=industryclass.industryclassid" _
& " and [user].userid=business.userid"Top
2 楼pengdali()回复于 2003-09-02 08:09:59 得分 10
strBusi="select a.userid,email,companyname,Industrytype, Industryclass,type,hot,title,content,keyword,msgdate,linkUrl "_
& " From [User] a, Business b, IndustryType c, IndustryClass d Where messageid="&Request.QueryString("messageid") _
& " and a.IndustryTypeid=c.IndustryTypeid and a.IndustryTypeid=d.IndustryTypeid and a.industryclassid=d.industryclassid" _
& " and a.userid=b.userid"Top
3 楼txlicenhe(马可)回复于 2003-09-02 08:17:42 得分 10
strBusi="select user.userid,email,companyname,Industrytype, Industryclass,type,hot,title,content,keyword,msgdate,linkUrl "_
& " From [User] , Business, IndustryType, IndustryClass Where messageid="&Request.QueryString("messageid") _
& " and user.IndustryTypeid=IndustryType.IndustryTypeid and [user].IndustryTypeid=industryclass.IndustryTypeid and [user].industryclassid=industryclass.industryclassid" _
& " and [user].userid=business.userid"
Top
4 楼yyy431706(观兰)回复于 2003-09-02 09:14:55 得分 10
把user改名
或改为[user]
在sql server中,
USER 提供与 USER_NAME 系统函数相同的功能。
在 CREATE TABLE 或 ALTER TABLE 语句中将 USER 和 DEFAULT 约束一起使用,或者将 USER 作为任何标准函数使用。
示例
A. 使用 USER 返回当前用户的数据库用户名
本示例声明一个 char 类型的变量,将 USER 的当前值赋给它,然后打印该变量以及文本说明。
DECLARE @usr char(30)
SET @usr = user
SELECT 'The current user's database username is: '+ @usr
GO
下面是结果集:
-----------------------------------------------------------------------
The current user's database username is: dbo
(1 row(s) affected)
B. 将 USER 和 DEFAULT 约束一起使用
本示例生成一个表,将 USER 用作销售行的销售员的 DEFAULT 约束。
USE pubs
GO
CREATE TABLE inventory2
(
part_id int IDENTITY(100, 1) NOT NULL,
description varchar(30) NOT NULL,
entry_person varchar(30) NOT NULL DEFAULT USER
)
GO
INSERT inventory2 (description)
VALUES ('Red pencil')
INSERT inventory2 (description)
VALUES ('Blue pencil')
INSERT inventory2 (description)
VALUES ('Green pencil')
INSERT inventory2 (description)
VALUES ('Black pencil')
INSERT inventory2 (description)
VALUES ('Yellow pencil')
GO
下面是从表 inventory2 中选择所有信息的查询:
SELECT *
FROM inventory2
ORDER BY part_id
GO
下面是结果集(注意 entry-person 的值):
part_id description entry_person
----------- ------------------------------ -----------------------------
100 Red pencil dbo
101 Blue pencil dbo
102 Green pencil dbo
103 Black pencil dbo
104 Yellow pencil dbo
(5 row(s) affected)
Top
5 楼myflok(老虎爱吃肉)回复于 2003-09-02 09:44:42 得分 10
把user改名
或改为[user]
Top
6 楼sdhdy(大江东去...)回复于 2003-09-02 09:54:02 得分 10
--把user改为[user]
strBusi="select a.userid,email,companyname,Industrytype, Industryclass,type,hot,title,content,keyword,msgdate,linkUrl "_
& " From [User] a, Business b, IndustryType c, IndustryClass d Where messageid="&Request.QueryString("messageid") _
& " and a.IndustryTypeid=c.IndustryTypeid and a.IndustryTypeid=d.IndustryTypeid and a.industryclassid=d.industryclassid" _
& " and a.userid=b.userid"
Top
相关问题
- ASP连接SQL SERVER语句问题
- 请问:在ASP中使用SQL SERVER语句更新数据库怎样知道SQL SERVER语句执行成功?
- 请asp+server高手帮忙分析一个sql语句
- --SQL SERVER语句问题:
- ----SQL SERVER语句问题:
- sql语句的问题!急!!!!(asp+acess),sql语句如何写?
- sql语句的问题!急!!!!(asp+acess),sql语句如何写?
- ASP与SQL Server连接,SQL Server采用Windows登陆与SQL登陆时的连接语句有什么不同?
- SQL server的SQL语句问题(和case语句有关)
- MS SQL SERVER 语句 转化为 PL*SQL语句 的问题,急!!!!!




