我是SQL新手并尝试将C#linq查询转换为存储过程。
Linq查询如下所示:
if (subscription.address1 != null)
address1 = subscription.CountryNames.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries).ToList();
if (subscription.address2 != null)
address2= subscription.CountryNames.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries).ToList();
var query = context
.Information
.Where(item => item.AppearanceDate >= dateFromDT && item.AppearanceDate <= dateToDT);
if (address1.Count > 0)
query = query.Where(item => address1.Contains(item.address1));
if (address2.Count > 0)
query = query.Where(item => address2.Contains(item.address2));
var results = query.select.toList()
表名:信息
专栏:
Person_Name
address1
address2
address2
和address1
传入
如何为此编写存储过程?
我必须为每个地址和查询创建一个#Temp
表吗?提前致谢