让人郁闷的程序建视图问题
郁闷死了,这二天为这个程序新建视图问题给搞晕了。CREATE VIEW dbo.VIEW_sell_price as SELECT goods_id, sell_N, sell_N * price AS sell_price, avg_price, dd_id FROM dbo.T_sell_mx GROUP BY goods_id
我用上术语句新建一个视图。我在SQL中直接测试一切OK
可我把它应用在ASP中:
sql="CREATE VIEW VIEW_price as SELECT goods_id, SUM(N_in) AS max_N_in, SUM(N_out) AS max_N_out, SUM(N_in) - SUM(N_out) AS KC FROM dbo.T_stock GROUP BY goods_id"
gconnect2.Execute (SQL)
sql="CREATE VIEW dbo.VIEW_sell_price as SELECT goods_id, sell_N, sell_N * price AS sell_price, avg_price, dd_id FROM [dbo.T_sell_mx] GROUP BY goods_id"
gconnect2.Execute (SQL)
前二句正常,一切OK,最后这一句说:
Microsoft OLE DB Provider for SQL Server 错误 '80040e37'
对象名 'T_sell_mx' 无效。
我的问题是:
第一:T_sell_mx绝对存在。
第二:就它在SQL中运行一切正常,可以生成我要的视图。
为什么第一个视图可以被建成,这第二个就执行不了了呢?
有谁遇到过类似问题?