SQL Enterprise不更新表 [英] SQL Enterprise not updating table

查看:93
本文介绍了SQL Enterprise不更新表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我在Enterprise Job Scheduler中有以下代码,它运行成功,但表格没有更新。我首先将它放入存储过程但是当它们不起作用时,我只是将代码直接插入到调度程序中。它应该在每天凌晨5点更新,但是当我第二天运行我的水晶报告时,表格中的任何内容都没有更新。请帮忙!


这是SQL脚本。我不知道任何其他编码做法。 - JO

插入NewCustomers

select cust.c_id_alpha Location_ID,cust.c_name Location_name,

substring(CUST.c_name,CHARINDEX (''#'',CUST.c_name)+ 1,((len(CUST.c_name) - (len(CUST.c_Name) - CHARINDEX(''''',CUST.c_name)))))Store_no,

C_ADDRNUM1,C_ADDR1,C_ADDR2,

C_CITY,C_STATE,C_ZIP,C_PHO,C_FAX Cust_Fax_No,c_pcont Cust_Contact,null,cmpy.company

来自cust内部联接udef_active_cstat ud on cust.c_cstat = ud.unique_id

left join dbo.ups_keepers k on cust.c_id = k.c_id

inner join cmpy on cust.b_bill_co = cmpy.cmpy_id

where right(cust.c_id_alpha,3)<> ''001''

和b_bill_co不在(30,2,26,29,4)

和c_quote> = getdate() - 1


更新NewCustomers

set Standard_Instructions = rxrf.comment

FROM cust inner join udef_active_cstat ud on cust.c_cstat = ud.unique_id

离开加入dbo.ups_keepers k on cust.c_id = k.c_id

内部联接rxrf on cust.c_id = rxrf.c_id

内部联接cmpy on cust .b_bill_co = cmpy.cmpy_id

内部联接NewLustomers L on L.Location_id = cust.c_id_alpha

where right(cust.c_id_alpha,3)<> ''001''

和b_bill_co不在(30,2,26,29,4)

和c_quote> = getdate() - 1


更新NewCustomers设置c_pho = replace(c_pho,'' - '','''')

更新NewCustomers设置c_pho = replace(c_pho,'')'' ,'''')

更新NewCustomers设置c_pho = replace(c_pho,''('','''')

更新NewCustomers设置c_pho = replace(c_pho ,'''','''')

更新NewCustomers设置c_zip = replace(c_zip,'' - '','''')

更新NewCustomers设置cust_FAX_no = replace(cust_fax_no,'' - '','''')

推荐答案

如果没有错误,可以假设您的更新查询不会影响任何行,因为没有找到匹配项。检查您的选择查询是否首先返回任何行。
If you''re getting no error, one can assume that your update query affects no rows because no matches are found. Check whether your select query returns any rows first.


确定它的getdate()函数。我试图在凌晨5点拉前一天的新客户把它们添加到这个表。当我放入昨天的日期时,当我输入getdate()时我会得到它们-1)我不是吗?我没有使用正确的日期函数吗?


getdate() - 1< ---这是不正确的?
ok its the getdate() function. I am trying to pull at 5am the previous day''s new customers and add them to this table. When I put in yesterdays date, I get them when I put in getdate() -1 I dont? Am I not using the correct date function?

getdate() - 1 <--- is this not correct?



ok它的getdate()函数。我试图在前一天凌晨5点拉新客户并将它们添加到此表中。当我放入昨天的日期时,当我输入getdate()时我会得到它们 - 我不是吗?我没有使用正确的日期函数吗?


getdate() - 1< ---这不正确吗?
ok its the getdate() function. I am trying to pull at 5am the previous day''s new customers and add them to this table. When I put in yesterdays date, I get them when I put in getdate() -1 I dont? Am I not using the correct date function?

getdate() - 1 <--- is this not correct?



服务器上的时间可能设置为GMT,因此偏移量。确保你适应它。

The time on the server might be set to GMT hence the offset. Make sure you accomodate for it.


这篇关于SQL Enterprise不更新表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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