如何优化这个存储过程 只有代码不能说从哪里优化好。根据实际,对相应的表建立合适的索引来达到提高查询效率。还有就是in ()可以考虑使用EXISTS() NOT IN()可以考虑使用NOT EXISTS() 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 还有下面一个:CREATE Procedure [dbo].cs_Section_Get( @SettingsID int, @SectionID int, @ApplicationKey nvarchar(512) = null, @ApplicationType smallint)asSET Transaction Isolation Level Read UNCOMMITTEDif(@ApplicationKey is not null)Begin Select @SectionID = SectionID FROM cs_Sections where ApplicationKey = @ApplicationKey and ApplicationType = @ApplicationTypeEndSELECT SectionID, SettingsID, IsActive, ParentID, GroupID, [Name], NewsgroupName, [Description], DateCreated, Url, IsModerated, DaysToView, SortOrder, TotalPosts, TotalThreads, DisplayMask, EnablePostStatistics, EnablePostPoints, EnableAutoDelete, EnableAnonymousPosting, AutoDeleteThreshold, MostRecentPostID, MostRecentThreadID, MostRecentThreadReplies, MostRecentPostSubject, MostRecentPostAuthor, MostRecentPostAuthorID, MostRecentPostDate, PostsToModerate, ForumType, IsSearchable, ApplicationType, ApplicationKey, PropertyNames as SectionPropertyNames, PropertyValues as SectionPropertyValues, Path, DefaultLanguageFROM cs_Sections Where SectionID = @SectionID and ApplicationType = @ApplicationTypeexec cs_Section_Permissions_Get @SettingsID, @SectionID, @ApplicationTypeGO 请问如何合并这两张表,在线等答案,谢谢 紧急求助:我应不应该为自己申请一份工资以外的开发费用??? 请教高手:备份和恢复的难题! 请问怎么样累计部分列值相同的行的某一列的总合 请问查询分析器下如何写一段角本.. 手动操作数据库 报超时。。。。高手请指教 select * from Tablename 结果为30万条纪录.但sqlserver在此语句执行10切分钟后仍然占用系统mem 80m,如何执行语句后释放内存!! 送分1 如何使用GROUP BY *.occ 是什么个软件,怎么生成的 Sql Server 2000全文索引在机器重启后就出错,怎么办? 求一SQL语句优化
(
@SettingsID int,
@SectionID int,
@ApplicationKey nvarchar(512) = null,
@ApplicationType smallint
)as
SET Transaction Isolation Level Read UNCOMMITTEDif(@ApplicationKey is not null)
Begin
Select @SectionID = SectionID FROM cs_Sections where ApplicationKey = @ApplicationKey and ApplicationType = @ApplicationType
EndSELECT
SectionID, SettingsID, IsActive, ParentID, GroupID, [Name], NewsgroupName, [Description],
DateCreated, Url, IsModerated, DaysToView, SortOrder, TotalPosts, TotalThreads, DisplayMask,
EnablePostStatistics, EnablePostPoints, EnableAutoDelete, EnableAnonymousPosting, AutoDeleteThreshold,
MostRecentPostID, MostRecentThreadID, MostRecentThreadReplies, MostRecentPostSubject,
MostRecentPostAuthor, MostRecentPostAuthorID, MostRecentPostDate, PostsToModerate, ForumType,
IsSearchable, ApplicationType, ApplicationKey, PropertyNames as SectionPropertyNames, PropertyValues as SectionPropertyValues, Path, DefaultLanguage
FROM
cs_Sections
Where SectionID = @SectionID and ApplicationType = @ApplicationTypeexec cs_Section_Permissions_Get @SettingsID, @SectionID, @ApplicationTypeGO