Need SQL Server Stored Procedure for This Query

Posted by djshortbus on Stack Overflow See other posts from Stack Overflow or by djshortbus
Published on 2010-05-22T05:50:19Z Indexed on 2010/05/22 6:10 UTC
Read the original article Hit count: 275

Filed under:
|
|

I have a ASPX.NET DataGrid and im trying to USE a select LIKE 'X'% from a table that has 1 field called location. im trying to display the locations that start with a certain letter (example wxxx,axxx,fxxx,) in different columns in my data grid.

SELECT
DISTINCT LM.LOCATION AS '0 LOCATIONS' ,
LM.COUNTLEVEL AS 'COUNTLEVEL'
FROM  SOH S WITH(NOLOCK)
  JOIN LOCATIONMASTER LM ON LM.LMID = S.LMID
WHERE
LM.COUNTLEVEL = 1 AND
LM.LOCATION NOT IN ('RECOU','PROBLEM','TOSTOCK','PYXVLOC')
AND LM.LOCATION LIKE '0%'


SELECT
DISTINCT LM.LOCATION AS 'A LOCATIONS' ,
LM.COUNTLEVEL AS 'COUNTLEVEL'
FROM  SOH S WITH(NOLOCK)
  JOIN LOCATIONMASTER LM ON LM.LMID = S.LMID
WHERE
LM.COUNTLEVEL = 1 AND
LM.LOCATION NOT IN ('RECOU','PROBLEM','TOSTOCK','PYXVLOC')
AND LM.LOCATION LIKE 'A%'

© Stack Overflow or respective owner

Need SQL Server Stored Procedure for This Query

Posted by djshortbus on Stack Overflow See other posts from Stack Overflow or by djshortbus
Published on 2010-05-22T06:30:57Z Indexed on 2010/05/22 6:40 UTC
Read the original article Hit count: 276

I have a ASPX.NET DataGrid and im trying to USE a select LIKE 'X'% from a table that has 1 field called location. im trying to display the locations that start with a certain letter (example wxxx,axxx,fxxx,) in different columns in my data grid.

SELECT
DISTINCT LM.LOCATION AS '0 LOCATIONS' ,
LM.COUNTLEVEL AS 'COUNTLEVEL'
FROM  SOH S WITH(NOLOCK)
  JOIN LOCATIONMASTER LM ON LM.LMID = S.LMID
WHERE
LM.COUNTLEVEL = 1 AND
LM.LOCATION NOT IN ('RECOU','PROBLEM','TOSTOCK','PYXVLOC')
AND LM.LOCATION LIKE '0%'

SELECT
DISTINCT LM.LOCATION AS 'A LOCATIONS' ,
LM.COUNTLEVEL AS 'COUNTLEVEL'
FROM  SOH S WITH(NOLOCK)
  JOIN LOCATIONMASTER LM ON LM.LMID = S.LMID
WHERE
LM.COUNTLEVEL = 1 AND
LM.LOCATION NOT IN ('RECOU','PROBLEM','TOSTOCK','PYXVLOC')
AND LM.LOCATION LIKE 'A%'

© Stack Overflow or respective owner

Related posts about sql

Related posts about stored-procedures