很特殊的sql

<!-- /* Font Definitions */ @font-face {font-family:宋体; panose-1:2 1 6 0 3 1 1 1 1 1; mso-font-alt:SimSun; mso-font-charset:134; mso-generic-font-family:auto; mso-font-pitch:variable; mso-font-signature:3 135135232 16 0 262145 0;} @font-face {font-family:ˎ̥; panose-1:0 0 0 0 0 0 0 0 0 0; mso-font-alt:"Times New Roman"; mso-font-charset:0; mso-generic-font-family:roman; mso-font-format:other; mso-font-pitch:auto; mso-font-signature:0 0 0 0 0 0;} @font-face {font-family:"/@宋体"; panose-1:2 1 6 0 3 1 1 1 1 1; mso-font-charset:134; mso-generic-font-family:auto; mso-font-pitch:variable; mso-font-signature:3 135135232 16 0 262145 0;} @font-face {font-family:SimSun; panose-1:0 0 0 0 0 0 0 0 0 0; mso-font-alt:Tahoma; mso-font-charset:0; mso-generic-font-family:roman; mso-font-format:other; mso-font-pitch:auto; mso-font-signature:0 0 0 0 0 0;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {mso-style-parent:""; margin:0cm; margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:12.0pt; font-family:"Times New Roman"; mso-fareast-font-family:SimSun; mso-ansi-language:EN-GB;} p {mso-margin-top-alt:auto; margin-right:0cm; mso-margin-bottom-alt:auto; margin-left:0cm; mso-pagination:widow-orphan; font-size:12.0pt; font-family:宋体; mso-bidi-font-family:宋体;} /* Page Definitions */ @page {mso-page-border-surround-header:no; mso-page-border-surround-footer:no;} @page Section1 {size:612.0pt 792.0pt; margin:72.0pt 72.0pt 72.0pt 72.0pt; mso-header-margin:36.0pt; mso-footer-margin:36.0pt; mso-paper-source:0;} div.Section1 {page:Section1;} -->

1

select Seeds_CaseMaster.Case_ID as Case_ID,

(select top 1 SEEDS_MODULE from SEEDS_QUEUE_MODULE,seeds_caseactivity where seeds_caseactivity.Case_ID=seeds_caseMaster.Case_ID and PATINDEX('%'+ rtrim(LTRIM(SEEDS_QUEUE))+'%',seeds_caseactivity.Additional_Info) <> 0 and seeds_caseactivity.Activity like 'Accept%' ORDER BY seeds_caseactivity.Activity_Time DESC ) as SEEDS_MODULE

  into #a

from Seeds_CaseMaster

 

 

update Seeds_CaseMaster

  set ModuleCode=#a.SEEDS_MODULE

from #a,Seeds_CaseMaster

  where Seeds_CaseMaster.Case_ID

=#a.Case_ID and isnull(#a.SEEDS_MODULE,'0')<>'0'

 

drop table #a

 

 

 

2

SET QUOTED_IDENTIFIER ON

GO

SET ANSI_NULLS ON

GO

 

ALTER  Procedure MRF_Common_GetEmails_NewRegistration

       @in_Country as int

AS

 

 

Declare @strEmails as varchar(4000)

set @strEmails = ''

 

select @strEmails = CASE @strEmails

                                   when '' then [User].User_Email

                                   else @strEmails + ';' + [User].[User_Email]

                                   END

  from MRF_Country Country

JOIN MRF_User_Region UserRegion ON Country.CNTR_RGN_ID = UserRegion.USRG_RGN_ID

JOIN MRF_User [User] on [User].[USER_ID] = UserRegion.USRG_User_ID

where Country.CNTR_ID = @in_Country -- For Regional Admin

 

select @strEmails = CASE @strEmails

                                   when '' then [User].User_Email

                                   else @strEmails + ';' + [User].[User_Email]

                                   END

  from MRF_User_Role UserRole

  JOIN MRF_User [User] on [User].[USER_ID] = UserRole.USRL_User_ID

  WHERE UserRole.USRL_Role_ID = 1  -- For GLobal Admin

 

select @strEmails

GO

SET QUOTED_IDENTIFIER OFF

GO

SET ANSI_NULLS ON

GO

3

复制表 ( 只复制结构 , 源表名: a 新表名: b)

select * into b from a where 1<>1

4

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[S_Case_ClosureReport]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)

 

5

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[RESOLUTION_TIME_DETAIL1]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值