August 14, 2013 at 9:23 am
Want to convert VB Code to SQL
Dim objMyForm
objMyForm = CreateObject("CutePDF.Document")
objMyForm.initialize("DEMO-SDK-84232865-00514228")
objMyForm.openFile("x:\skb\rmfg-0202.pdf")
objMyForm.setField("KO No", "Acro Software Inc.")
objMyForm.saveFile("x:\skb\Form01.pdf")
Above code works fine.
This is what attempted but its not working
declare @objMyForm integer, @rs integer
execute @rs = dbo.sp_OACreate 'CutePDF.Document', @objMyForm OUTPUT
execute @rs = master.dbo.sp_OAMethod @objMyForm, 'initialize' , 'DEMO-SDK-84232865-00514228'
execute @rs = master.dbo.sp_OAMethod @objMyForm, 'OpenFile' , 'x:\skb\RMFG-0202.pdf'
execute @rs = master.dbo.sp_OAMethod @objMyForm, 'SaveFile' , 'x:\skb\Form01.pdf'
execute @rs = master.dbo.sp_OADestroy @objMyForm
August 14, 2013 at 9:32 am
Nice code. Thanks for posting here. 🙂
You might want to add whatever question you have. 😎
For best practices on asking questions, please read the following article: Forum Etiquette: How to post data/code on a forum to get the best help[/url]
August 14, 2013 at 9:48 am
Why do you want to do this in t-sql? It is the wrong tool for the job. A CLR proc, SSIS or even an application would be a much better choice here.
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
August 14, 2013 at 9:50 am
I want to populate the pdf form using large sql data
August 14, 2013 at 9:54 am
skb 44459 (8/14/2013)
I want to populate the pdf form using large sql data
OK.
Why do you want to do this in t-sql? It is the wrong tool for the job. A CLR proc would be a much better choice here.
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
August 14, 2013 at 10:02 am
Sean Lange (8/14/2013)
skb 44459 (8/14/2013)
I want to populate the pdf form using large sql dataOK.
Why do you want to do this in t-sql? It is the wrong tool for the job. A CLR proc would be a much better choice here.
I agree.
For best practices on asking questions, please read the following article: Forum Etiquette: How to post data/code on a forum to get the best help[/url]
August 14, 2013 at 10:02 am
Maybe instead of taking code you found in a 6 year old thread here on ssc and asking us to convert it to t-sql you can tell us what you are actually trying to do.
(http://www.sqlservercentral.com/Forums/Topic383628-131-1.aspx)
The code posted there only saves a copy of a pdf, you sound like you want to create your own pdfs using data found in your database? If you can provide the details of what you want to accomplish we can help you figure out a good way to it. Using t-sql with sp_OACreate to generate a pdf is not the best way.
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
August 14, 2013 at 10:53 am
I am not aware of CLR Procs at all. But I am open to any good solutions.
I want to write a Stored Procedure which will
- Open a PDF template (Template has all the form field defined)
- put sql data into the pdf file.
-Save the pdf file on network location.
August 14, 2013 at 12:38 pm
skb 44459 (8/14/2013)
I am not aware of CLR Procs at all. But I am open to any good solutions.I want to write a Stored Procedure which will
- Open a PDF template (Template has all the form field defined)
- put sql data into the pdf file.
-Save the pdf file on network location.
In a nutshell a CLR procedure is a way to write your code in .NET and call that from sql as a stored procedure. Can you write the code to do this in .NET? The CLR portion is pretty simple.
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
August 14, 2013 at 9:00 pm
skb 44459 (8/14/2013)
This is what attempted but its not working
What's not working about it? Are you getting any error messages?
Also, what do you get when you run the following?
EXEC xp_dirtree 'x:\skb\',1,1;
--Jeff Moden
Change is inevitable... Change for the better is not.
August 14, 2013 at 9:07 pm
Sean Lange (8/14/2013)
Why do you want to do this in t-sql? It is the wrong tool for the job. A CLR proc, SSIS or even an application would be a much better choice here.
If you have someone that can write a CLR, use SSIS, or write an application to do it, maybe. 😉
--Jeff Moden
Change is inevitable... Change for the better is not.
August 14, 2013 at 9:09 pm
Sean Lange (8/14/2013)
Maybe instead of taking code you found in a 6 year old thread here on ssc and asking us to convert it to t-sql you can tell us what you are actually trying to do.(http://www.sqlservercentral.com/Forums/Topic383628-131-1.aspx)
I just have to ask... what in the world made you look for a previous thread on this?
--Jeff Moden
Change is inevitable... Change for the better is not.
August 15, 2013 at 7:20 am
Jeff Moden (8/14/2013)
Sean Lange (8/14/2013)
Maybe instead of taking code you found in a 6 year old thread here on ssc and asking us to convert it to t-sql you can tell us what you are actually trying to do.(http://www.sqlservercentral.com/Forums/Topic383628-131-1.aspx)
I just have to ask... what in the world made you look for a previous thread on this?
Didn't go searching for it. It popped up on the Active Threads and I noticed the most recent post was the same person. They were right next to each other on the list. 😉
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
Viewing 13 posts - 1 through 12 (of 12 total)
You must be logged in to reply to this topic. Login to reply