User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the MS SQL section within the Web Development category of DaniWeb, a massive community of 397,852 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,328 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our MS SQL advertiser:

common Question about CustomerID search

Join Date: Aug 2007
Location: KSA
Posts: 147
Reputation: kb.net is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 26
kb.net's Avatar
kb.net kb.net is offline Offline
Junior Poster

Re: common Question about CustomerID search

  #2  
Dec 23rd, 2007
Hi,

Create a stores procedure (called ex: CustInfo) and forward it the customer code to search for. The body of the procedure will be:
CREATE PROCEDURE CustInfo(@CustCod int) AS

	IF (Select count(*) from CustNew where CustNum= @CustCod)>=1 

	Select * from CustNew  where CustNum= @CustCod

	ELSE Select * from CustOld  where CustNum= @CustCod

GO

Then all what you will need to call is the stored procedure with the parameter which varies depending on the programming language you will use (but you can test it in SQL Query analyzer as: CustInfo 236)
It is never about the number of languages you know, you either have the logic of programming or you don't ...

Some of the codes I post are collected from different sites during the past couple of years, so I would like to thank them for their help and for enabling me to help.
Reply With Quote  
All times are GMT -4. The time now is 8:18 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC