我有这个要转换为存储过程的 sql 语句。我怎样才能做到这一点?
select a.name, a.lastname, from myTable where b.name= a.lastname
谢谢
更新这是对的人吗
CREATE PROCEDURE myProcedure
AS
BEGIN
SELECT [a.name],
[a.lastname]
FROM [myTable]
WHERE [b.name] = a.lastname
END
这是我真正正在研究的代码之一
sql语句
SELECT RTRIM(l.Lab1) + '/' + RTRIM(l.LabR) AS Lab, meta.Title,ls.[ID],ls.[surveyID], ls.[specialistID],ls.[isCompleted] FROM [MyDIM].[dbo].[lsLabSurvey] ls JOIN [MYDIM].[dbo].[dimDocMetaInfo] meta ON meta.id = ls.[surveyID] and specialistID = @PID and isCompleted=1 JOIN MyDatabase.DBO.PID_Table l ON ls.ID = l.ID
和我尝试的存储过程
CREATE PROCEDURE PROCD1
AS
BEGIN
SELECT RTRIM(l.Lab1) + '/' + RTRIM(l.LabR)
AS Lab,
meta.Title,
la.[ID],
ls.[surveyID],
ls.[specialistID],
ls.[isCompleted]
FROM [MyDIM].[dbo].[lsLabSurvey] ls
JOIN [MyDIM].[dbo].[dimDocMetaInfo] meta
ON meta.id = ls.[surveyID]
and specialistID = @PID
and isCompleted=1
JOIN MyDatabase.DBO.PID_Table l
ON ls.ID = l.ID
结尾