Kinook Software Forum

Go Back   Kinook Software Forum > Visual Build Professional > [VBP] Third Party Tools
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 10-29-2012, 02:39 PM
raghuk raghuk is online now
Registered User
 
Join Date: 02-10-2012
Posts: 11
Set temp macro from result of Run SQL action

Hello,

I have a need to set a local variable macro based on if the database exists or not.

I have the following query in "Run SQL" action.

if db_id('%CurrentDatabaseName%') is null
BEGIN
-- ???? STEP TO set local variable which effectively says 'NO DB'
END

How can I achieve this?

Thanks!
Reply With Quote
  #2  
Old 10-29-2012, 02:44 PM
raghuk raghuk is online now
Registered User
 
Join Date: 02-10-2012
Posts: 11
Quote:
Originally Posted by raghuk View Post
Hello,

I have a need to set a local variable macro based on if the database exists or not.

I have the following query in "Run SQL" action.

if db_id('%CurrentDatabaseName%') is null
BEGIN
-- ???? STEP TO set local variable which effectively says 'NO DB'
END

How can I achieve this?

Thanks!
In fact, if there is an "expression" that I could use to call this I would love that so that I can use the expression in "Build only if macro or expression" is true!

Thank you!
Reply With Quote
  #3  
Old 10-29-2012, 06:32 PM
kinook kinook is online now
Administrator
 
Join Date: 03-06-2001
Location: Colorado
Posts: 6,034
http://msdn.microsoft.com/en-us/library/ms189484.aspx
Reply With Quote
  #4  
Old 10-30-2012, 10:49 AM
raghuk raghuk is online now
Registered User
 
Join Date: 02-10-2012
Posts: 11
Quote:
Originally Posted by kinook View Post
Thanks , I am aware of the T-SQL syntax and I'm sure this is not the forum to discuss T-SQL issues.

The real question being, how do I set the value from T-SQL variable back to a macro defined within Visual Build Pro?

Thanks again!
Reply With Quote
  #5  
Old 10-30-2012, 10:56 AM
kinook kinook is online now
Administrator
 
Join Date: 03-06-2001
Location: Colorado
Posts: 6,034
Print the variable's value, parse it out of the LASTSTEP_OUTPUT macro value, and store in a macro.
http://msdn.microsoft.com/en-us/libr...SQL.90%29.aspx
http://www.kinook.com/VisBuildPro/Ma...riptevents.htm
Reply With Quote
  #6  
Old 10-31-2012, 11:29 AM
raghuk raghuk is online now
Registered User
 
Join Date: 02-10-2012
Posts: 11
Thank you! You are amazing as always!
Reply With Quote
  #7  
Old 08-20-2013, 05:54 PM
raghuk raghuk is online now
Registered User
 
Join Date: 02-10-2012
Posts: 11
name
--------------------------------------------------------------------------------------------------------------------------------
Music_log




Hello,

When I run the SQL to assign it to a variable, above is the output that I get from SQL. How do I parse to get only "Music_log"?

Thank you!
Reply With Quote
  #8  
Old 08-20-2013, 09:06 PM
kinook kinook is online now
Administrator
 
Join Date: 03-06-2001
Location: Colorado
Posts: 6,034
See the attached sample.
Attached Files
File Type: zip parse_text.zip (1,000 Bytes, 2422 views)
Reply With Quote
  #9  
Old 09-04-2013, 06:22 PM
Shiamak Shiamak is online now
Registered User
 
Join Date: 02-07-2006
Posts: 84
Do you have this .bld sample for v7.7 pro?
Reply With Quote
  #10  
Old 09-04-2013, 07:07 PM
kinook kinook is online now
Administrator
 
Join Date: 03-06-2001
Location: Colorado
Posts: 6,034
No, but it might work if you change the version in the .bld file (in a text editor) from 8 to 7.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



All times are GMT -5. The time now is 01:31 PM.


Copyright © 1999-2023 Kinook Software, Inc.