Friday, July 5, 2013

[SQL Server] How Stored Procedure determine to return a value?

[SQL Server] How Stored Procedure determine to return a value?


How Stored Procedure determine to return a value?

Posted: 05 Jul 2013 02:08 AM PDT

This is my Stored Procedure:[code="sql"]DECLARE @MyString NVARCHAR(3); SELECT @MyString = 'foo' SELECT CASE WHEN 1 = 1 THEN 'One is equal to one'END[/code]If I execute this Stored Procedure I have this output:[quote]'One is equal to one'[/quote]Now I change my Stored Procedure to this:[code="sql"]DECLARE @MyString NVARCHAR(3); SELECT CASE WHEN 1 = 1 THEN 'One is equal to one'ENDSELECT @MyString = 'foo'[/code]Now if I execute my Stored Procedure once again I have this output:[quote]'One is equal to one'[/quote]Why? I expected this time I should have 'foo' as output.Because the last SELECT statement is 'foo'

Add Variable to integer

Posted: 05 Jul 2013 05:02 AM PDT

HiI declared the primary key as identity int.Now everytime a value(code) is selected from the grid , I want a corresponding character to be concatenated to the primary key( integer) and stored in another column.Example : if code = student then add "S" to "1" and store S1 to another column.else if code = Teacher then add "T" to 2 and store T2.How should I implement this logic?

What is # in first letter of table names?

Posted: 04 Jul 2013 11:34 PM PDT

Ive noticed dudes in this forum uses # for the first letter of their table names.Does it have any special meaning?Does SQL Server have different behavior with them?Or its just a letter like a,b,c... etc?

default trace configurations

Posted: 04 Jul 2013 11:10 PM PDT

Hi,Just curiosity to know... there will be 5 trace files with each 20 MB size for default trace. Can it be increased to more number of files to preserve, as well as is it possible to increase the size from 20 MB to more?Please let me know. Thanks

No comments:

Post a Comment

Search This Blog