SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Sql Query using Output
 New Topic  Reply to Topic
 Printer Friendly
Previous Page
Author Previous Topic Topic Next Topic
Page: of 2

sunitabeck
Flowing Fount of Yak Knowledge

5155 Posts

Posted - 12/13/2012 :  14:43:28  Show Profile  Reply with Quote
Quoting from MSDN Executes the query, and returns the first column of the first row in the result set returned by the query. Additional columns or rows are ignored.

So you might try adding a "SELECT @CompId" at the very end of the stored procedure - and then "zCompID = command.ExecuteScalar()" in the VB code will give you what you are looking for.

Also, be sure to insert a SET NOCOUNT ON at the very beginning of the stored proc.

Go to Top of Page

StacyOW
Yak Posting Veteran

USA
93 Posts

Posted - 12/13/2012 :  15:35:53  Show Profile  Reply with Quote
quote:
Originally posted by sunitabeck

Quoting from MSDN Executes the query, and returns the first column of the first row in the result set returned by the query. Additional columns or rows are ignored.

So you might try adding a "SELECT @CompId" at the very end of the stored procedure - and then "zCompID = command.ExecuteScalar()" in the VB code will give you what you are looking for.

Also, be sure to insert a SET NOCOUNT ON at the very beginning of the stored proc.




YES! You rock! That was it I had to use both the SET and the SELECT SCOPE_IDENTITY! Now it does both all insert queries and returns my @CompID!

Thank you sooooooooooooooooooo much! HAVE A GREAT HOLIDAYS!
Stacy
Go to Top of Page

ramesh.ld9
Starting Member

India
2 Posts

Posted - 12/14/2012 :  00:50:40  Show Profile  Reply with Quote
Hi, following is the mysql query,

DELETE FROM ATTRIBUTE_INSTANCE WHERE ATTRIBUTE_INSTANCE.ATTRIBUTE_NAME 
			IN ( SELECT CONCAT(ATTRIBUTE_TEMPLATE.TEMPLATE_ID,'.',ATTRIBUTE_TEMPLATE.ATTRIBUTE_NAME) FROM 
			ATTRIBUTE_TEMPLATE, TEMP_ENTITY_TABLE WHERE 
			ATTRIBUTE_TEMPLATE.TEMPLATE_ID=TEMP_ENTITY_TABLE.ENTITY_ID);		



What will be the eqvuvalent query in sql server?

please help me

Thanks,


rameshLD
Go to Top of Page

bandi
Flowing Fount of Yak Knowledge

India
2217 Posts

Posted - 12/14/2012 :  01:03:12  Show Profile  Reply with Quote

IN ( SELECT CAST(ATTRIBUTE_TEMPLATE.TEMPLATE_ID AS VARCHAR(20)) + '.' + ATTRIBUTE_TEMPLATE.ATTRIBUTE_NAME 
    FROM ............
   )


One more suggestion is:
You have to post your queries as a new post

--
Chandu
Go to Top of Page

ramesh.ld9
Starting Member

India
2 Posts

Posted - 12/14/2012 :  03:16:28  Show Profile  Reply with Quote
thank u
Go to Top of Page

bandi
Flowing Fount of Yak Knowledge

India
2217 Posts

Posted - 12/14/2012 :  03:20:44  Show Profile  Reply with Quote
quote:
Originally posted by ramesh.ld9

thank u


Welcome


--
Chandu
Go to Top of Page
Page: of 2 Previous Topic Topic Next Topic  
Previous Page
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.08 seconds. Powered By: Snitz Forums 2000