Click here to Skip to main content
15,894,955 members
Home / Discussions / Database
   

Database

 
AnswerRe: how to generate ID field with auto numbering Pin
Reza Raad9-Mar-09 18:20
Reza Raad9-Mar-09 18:20 
QuestionDB2 - SQL where selects field that contains @ Pin
Kschuler9-Mar-09 6:43
Kschuler9-Mar-09 6:43 
Answer2 Pin
Luc Pattyn9-Mar-09 7:11
sitebuilderLuc Pattyn9-Mar-09 7:11 
GeneralRe: 2 Pin
Kschuler9-Mar-09 7:19
Kschuler9-Mar-09 7:19 
GeneralRe: 2 Pin
Luc Pattyn9-Mar-09 7:34
sitebuilderLuc Pattyn9-Mar-09 7:34 
GeneralRe: 2 Pin
Kschuler9-Mar-09 7:38
Kschuler9-Mar-09 7:38 
GeneralRe: 2 Pin
Luc Pattyn9-Mar-09 7:48
sitebuilderLuc Pattyn9-Mar-09 7:48 
GeneralRe: 2 Pin
Kschuler9-Mar-09 8:05
Kschuler9-Mar-09 8:05 
AnswerRe: DB2 - SQL where selects field that contains @ Pin
Kschuler9-Mar-09 9:08
Kschuler9-Mar-09 9:08 
GeneralRe: DB2 - SQL where selects field that contains @ Pin
Luc Pattyn9-Mar-09 10:01
sitebuilderLuc Pattyn9-Mar-09 10:01 
Questionhow to use stored procedure argument with like operator Pin
Meax7-Mar-09 8:03
Meax7-Mar-09 8:03 
AnswerRe: how to use stored procedure argument with like operator Pin
Meax7-Mar-09 9:31
Meax7-Mar-09 9:31 
GeneralRe: how to use stored procedure argument with like operator Pin
Colin Angus Mackay7-Mar-09 12:23
Colin Angus Mackay7-Mar-09 12:23 
GeneralRe: how to use stored procedure argument with like operator Pin
Rami Said Abd Alhalim9-Mar-09 21:43
Rami Said Abd Alhalim9-Mar-09 21:43 
if you need too many operators you must use dynamic variable
for example:


-- this stored procedure used to search

create PROCEDURE [dbo].[SP__Find_Country]
(
@chv_Country_name varchar(150)=null,
@Calling_no varchar(5)=null,
@Short_Name varchar(3)=null
)

AS
set nocount on
Declare @Condition varchar(8000)
Set @condition =''


IF @chv_Country_name is not null
set @Condition=' co_name like ''' +@chv_Country_name + '%'''
IF @Calling_no is Not Null and @Condition =''
set @Condition=' co_Calling_code like ''' +@Calling_no + '%'''
else If @Calling_no is not Null
set @Condition=@Condition +' and co_Calling_code like ''' +@Calling_no + '%'''

IF @Short_Name is not null and @Condition =''
Set @Condition=' co_Short_Name like ''' +@Short_Name + '%'''
else IF @Short_Name is not null
Set @Condition=@Condition+' and co_Short_Name like ''' +@Short_Name + '%'''
if @Condition <> ''
Set @Condition=@Condition+' and co_deleted=0'
print @condition
if @condition =''
select * from Country
where co_deleted=0 -- Updated by Nabeel Adnan
Order By Country.co_name -- Updated By Mahmoud Khalil
else
begin
Exec ('select * from Country where '+ @condition + ' Order By co_name ')
print 'select * from Country where '+ @condition + ' Order By co_name '
end
GeneralRe: how to use stored procedure argument with like operator Pin
Colin Angus Mackay10-Mar-09 13:17
Colin Angus Mackay10-Mar-09 13:17 
QuestionSQL search all columns [modified] Pin
Expert Coming7-Mar-09 4:43
Expert Coming7-Mar-09 4:43 
AnswerRe: SQL search all columns Pin
Eddy Vluggen7-Mar-09 4:47
professionalEddy Vluggen7-Mar-09 4:47 
AnswerRe: SQL search all columns Pin
Kschuler9-Mar-09 8:10
Kschuler9-Mar-09 8:10 
QuestionCheck if SQL is doing some king of process Pin
cdpace6-Mar-09 22:17
cdpace6-Mar-09 22:17 
AnswerRe: Check if SQL is doing some king of process Pin
Expert Coming7-Mar-09 4:24
Expert Coming7-Mar-09 4:24 
AnswerRe: Check if SQL is doing some king of process Pin
Colin Angus Mackay7-Mar-09 12:20
Colin Angus Mackay7-Mar-09 12:20 
QuestionServer 08 Execute SQL Pin
enipla6-Mar-09 9:45
enipla6-Mar-09 9:45 
AnswerRe: Server 08 Execute SQL Pin
Colin Angus Mackay7-Mar-09 12:14
Colin Angus Mackay7-Mar-09 12:14 
GeneralRe: Server 08 Execute SQL Pin
enipla10-Mar-09 3:14
enipla10-Mar-09 3:14 
GeneralRe: Server 08 Execute SQL Pin
Colin Angus Mackay10-Mar-09 13:29
Colin Angus Mackay10-Mar-09 13:29 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.