我可以使用`set ANSI_NULLS OFF

时间:2010-11-10 13:45:52

标签: tsql

在存储过程中我无法设置set ANSI_NULLS OFF而不是在我的一个查询中使用(first_name IS NULL) ... 我也想知道如何调试存储过程以及如何查看存储过程生成的结果...就像正常查询我得到选项sql写标签.......但我怎么能实现这个存储过程....请详细说明我

基本上我想知道,以下是我的确切查询

SELECT     student_id, first_name, last_name, user_name, password, father_name, DOB, gender, local_address, permanent_Address, phone, mobile, email, college_id, 
                      course_id, branch_id, highschool_passout_year, highschool_percentage, ssc_passout_year, ssc_percentage, passing_year_higher, graduation_percentage, 
                      graduation_passout_year, post_graduation_percentage, post_graduation_passout_year, diploma_percentage, diploma_passout_year, number_of_ATKT, 
                      current_backlog, gapin_education, sem1P, sem2P, sem3P, sem4P, sem5P, sem6P, sem7P, sem8P, total_sem_percentage, total_year_percentage, flag, image, 
                      native_place, high_school_board, ssc_board, diploma_university, graduation_university, post_graduation_university, training_details, Project_Work, Skills, 
                      extra_curricular, blood_group, profile_updated, year_of_admission, security_question, security_answer, admission_year, passing_year, enrollment_no, 
                      first_year_percent, second_year_percent, third_year_percent, final_year_percent, current_degree_percent, year1P, year2P, year3P, year4P, roll_no, 
                      diploma_details
FROM         tbl_students
WHERE     (first_name = 'Rupesh' COLLATE Latin1_General_CS_AS) OR
                      (first_name IS NULL)

现在我明确地检查名字是否为空,但我想知道我是否设置了SET ANSI然后我可以从我的查询中删除first_name = null并且仍然会得到正确的结果

1 个答案:

答案 0 :(得分:1)

如果关闭ansi nulls,则可以使用first_name = null

测试空值

至于调试你可以执行查询,在SQLServer Management studio中查看其结果,存储过程是按可编程性存储在每个数据库中的。存储过程

如果您正在运行脚本而不是单个语句,则可以使用print命令输出到结果窗格的“消息”选项卡