Click here to Skip to main content
16,015,623 members
Home / Discussions / Database
   

Database

 
AnswerRe: Null handling oddity Pin
Chris Meech20-Jan-12 13:42
Chris Meech20-Jan-12 13:42 
AnswerRe: Null handling oddity Pin
PIEBALDconsult20-Jan-12 15:29
mvePIEBALDconsult20-Jan-12 15:29 
GeneralRe: Null handling oddity Pin
thrakazog23-Jan-12 8:14
thrakazog23-Jan-12 8:14 
AnswerRe: Null handling oddity Pin
Jörgen Andersson21-Jan-12 1:37
professionalJörgen Andersson21-Jan-12 1:37 
AnswerRe: Null handling oddity Pin
Corporal Agarn23-Jan-12 5:09
professionalCorporal Agarn23-Jan-12 5:09 
GeneralRe: Null handling oddity Pin
thrakazog23-Jan-12 8:12
thrakazog23-Jan-12 8:12 
AnswerRe: Null handling oddity Pin
jschell23-Jan-12 8:33
jschell23-Jan-12 8:33 
GeneralRe: Null handling oddity Pin
thrakazog23-Jan-12 10:54
thrakazog23-Jan-12 10:54 
Gaaaah, I finally found the cause of the problem. I apparently created my original sproc with "SET ANSI_NULLS OFF". By default queries in management studio runs with ANSI_NULLS ON. DOH![^]

For a simple example of the sproc I was playing with:

SQL
create  PROCEDURE [dbo].[Bob_Test] 
   @MaterialNumber varchar(18)
AS

DECLARE @Replace varchar(18)

SELECT @MaterialNumber

IF (@Replace != '')
	SET @MaterialNumber = @Replace
	
SELECT @MaterialNumber


When I call this with ANSI_NULLS OFF
SQL
Bob_Test '123456'
my results show 123456 from the first select in the sproc, and NULL for the select after the if statement.

With ANSI_NULLS ON both selects return 123456. My faith SQL Server has been restored. Tune in next week for more inept coding... Cool | :cool:
Kill some time, play my game Hop Cheops[^]

QuestionUser Group Membership Pin
eddieangel19-Jan-12 11:40
eddieangel19-Jan-12 11:40 
AnswerRe: User Group Membership Pin
Mycroft Holmes19-Jan-12 12:01
professionalMycroft Holmes19-Jan-12 12:01 
GeneralRe: User Group Membership Pin
eddieangel19-Jan-12 12:05
eddieangel19-Jan-12 12:05 
GeneralRe: User Group Membership Pin
Mycroft Holmes19-Jan-12 13:00
professionalMycroft Holmes19-Jan-12 13:00 
GeneralRe: User Group Membership Pin
eddieangel19-Jan-12 14:30
eddieangel19-Jan-12 14:30 
GeneralRe: User Group Membership Pin
Mycroft Holmes19-Jan-12 14:40
professionalMycroft Holmes19-Jan-12 14:40 
GeneralRe: User Group Membership Pin
eddieangel20-Jan-12 6:16
eddieangel20-Jan-12 6:16 
GeneralRe: User Group Membership Pin
eddieangel20-Jan-12 6:51
eddieangel20-Jan-12 6:51 
GeneralRe: User Group Membership Pin
Jörgen Andersson21-Jan-12 1:43
professionalJörgen Andersson21-Jan-12 1:43 
GeneralRe: User Group Membership Pin
jschell20-Jan-12 12:51
jschell20-Jan-12 12:51 
AnswerRe: User Group Membership Pin
SilimSayo25-Jan-12 9:41
SilimSayo25-Jan-12 9:41 
QuestionConnectivity Options - selecting datasources on the fly Pin
john john mackey19-Jan-12 8:09
john john mackey19-Jan-12 8:09 
AnswerRe: Connectivity Options - selecting datasources on the fly Pin
Jörgen Andersson20-Jan-12 12:29
professionalJörgen Andersson20-Jan-12 12:29 
QuestionWhere to get suitable SQL Server Management Studio? Pin
adityarao3119-Jan-12 0:34
adityarao3119-Jan-12 0:34 
AnswerRe: Where to get suitable SQL Server Management Studio? Pin
Pete O'Hanlon19-Jan-12 0:42
mvePete O'Hanlon19-Jan-12 0:42 
AnswerRe: Where to get suitable SQL Server Management Studio? Pin
adityarao3119-Jan-12 18:01
adityarao3119-Jan-12 18:01 
QuestionConditional clause form two tables in sql server Pin
Seema Bawa18-Jan-12 12:48
Seema Bawa18-Jan-12 12:48 

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.