DECLARE @DSID NVarchar(50),@XMLPath Nvarchar(100),@RoldId int,@Debug varchar(max)
set @Debug=‘<Roles><Role code=”111″ name=”RoleName”><Persons><Person FName=”FName” LName=”LName” DSID=”564″ Email=”P@email.com” /><Person FName=”1FName” LName=”1LName” DSID=”1234″ Email=”P1@email.com” /></Persons></Role></Roles>’
set @RoldId = 111
if ( (convert(XML,@Debug)).exist(‘(/Roles/Role[@code= sql:variable("@RoldId")])’) =1 )
Begin
SELECT @DSID=(convert(XML,@Debug)).value(‘(/Roles/Role[@code= sql:variable("@RoldId")]/Persons/Person/@DSID)[1]‘,‘nvarchar(50)’)
print @DSID
select * from [Partner] where [ID]=@DSID
End
January 30, 2009
Categories: Sql server 2005 . . Author: bimal4u . Comments: Leave a Comment
Please select view and select server explorer, and connect database then select the procedure.
Then click the procedure and open it, then select the line and put the debug when you want to debugging. After that you select the procedure and right click and select option of ’step into store procedure’.
June 25, 2007
Categories: Sql server 2005 . . Author: bimal4u . Comments: Leave a Comment
set nocount on
create table #tbFruit (Fruit varchar(20))
insert into #tbFruit (Fruit) values (‘apple’)
insert into #tbFruit (Fruit) values (‘apple’)
insert into #tbFruit (Fruit) values (‘apple’)
insert into #tbFruit (Fruit) values (‘apple’)
insert into #tbFruit (Fruit) values (‘orange’)
insert into #tbFruit (Fruit) values (‘orange’)
insert into #tbFruit (Fruit) values (‘orange’)
create table #tbFruitsWithDupes (DupeID int identity, Fruit varchar(20), DupeCount int)
insert into #tbFruitsWithDupes (Fruit, DupeCount)
select [...]
April 30, 2007
Categories: Sql Server 2000, Sql server 2005 . . Author: bimal4u . Comments: Leave a Comment
Top 10 features
Other Reference http://www.developer.com/db/article.php/3512126
April 3, 2007
Categories: Sql server 2005 . . Author: bimal4u . Comments: Leave a Comment
Create procedure DeleteTest(@ID int)
as
begin
declare @cnt int
– delete current record
delete from newTest where id=@ID
– reset identity value to the total records in the table
select @cnt = isnull(max(ID),0) from newTest
DBCC CHECKIDENT ( ‘dbo.newTest’, RESEED, @cnt)
————-
For your reference http://msdn2.microsoft.com/en-us/library/ms176057.aspx
April 3, 2007
Categories: Sql Server 2000, Sql server 2005 . . Author: bimal4u . Comments: Leave a Comment