I want to create a cursor in which the select statement should be
dynamic:<o:p></o:p>
if @PhoneType = White<o:p></o:p>
Then the select statement should
be as<o:p></o:p>
selectdistinct
MODEL_NUM from
Dbo.Apple<o:p></o:p>
if @PhoneType = Black<o:p></o:p>
selectdistinct
MODEL_NUM from
Dbo.Samsung<o:p></o:p>
---------------------
IF@MobileId ISNOTNULL
BEGIN
IF@PhoneType ='white'
SET@SqlStmt ='select distinct MODEL_NUM from dbo.Apple'
IF@PhoneType ='Black'
SET@SqlStmt ='select distinct MODEL_NUM from dbo.Samsung'
declareMOBILE cursorfor
selectdistinct MODEL_NUM fromDbo.Apple