|
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO
-- Stored Procedure usp_Customers_SelectRowsByWhere
-- Purpose: Get All Rows from the table Customers
-- Parameters:
USE Northwind
-- First delete the stored procedure if it already exists.
If (EXISTS (SELECT * FROM dbo.sysobjects
WHERE (Name = 'usp_Customers_SelectRowsByWhere') AND (Type = 'P')))
DROP PROCEDURE usp_Customers_SelectRowsByWhere
GO
-- This stored procedure was created
-- on Saturday, December 02, 2006 at 10:33:54 PM.
-- Template: Retrieve All Rows
-- Purpose: Get All Rows from the table Customers
CREATE PROCEDURE usp_Customers_SelectRowsByWhere
@SqlWhere varchar(250)
AS
IF NOT @SqlWhere = ''
exec('SELECT
[Customers].[CustomerID] as CustomerID,
[Customers].[CompanyName] as CompanyName,
[Customers].[ContactName] as ContactName,
[Customers].[ContactTitle] as ContactTitle,
[Customers].[Address] as Address,
[Customers].[City] as City,
[Customers].[Region] as Region,
[Customers].[PostalCode] as PostalCode,
[Customers].[Country] as Country,
[Customers].[Phone] as Phone,
[Customers].[Fax] as Fax FROM [Customers] WHERE ' + @SqlWhere)
ELSE
exec('SELECT
[Customers].[CustomerID] as CustomerID,
[Customers].[CompanyName] as CompanyName,
[Customers].[ContactName] as ContactName,
[Customers].[ContactTitle] as ContactTitle,
[Customers].[Address] as Address,
[Customers].[City] as City,
[Customers].[Region] as Region,
[Customers].[PostalCode] as PostalCode,
[Customers].[Country] as Country,
[Customers].[Phone] as Phone,
[Customers].[Fax] as Fax FROM [Customers] ')
GO
-- End Procedure
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.
A list of licenses authors might use can be found here
Danilo is the creator of
SmartRules, a Business Rules Engine. He is an industry consultant working primarily with companies interested in implementing dynamic rules programming concepts to add flexibility to their architectures on web, CE, and desktop platforms. He operates his own website,
Kontac, where you will find more information.
To contact Danilo, email him at danilo.mendez@gmail.com.