I Want get All Code of stored procedure from database and convert that procedure in textfile and save that textfile in particular path in c#.net window application.
views:
51answers:
2
A:
In order to get the code for a stored procedure, you're probably going to have to query the system tables in the database. Look at the documentation for whatever RDBMS you're using.
As far as saving a text file goes, take a look at this howto.
lc
2010-06-03 09:46:06
+1
A:
With thanks to David Cumps (Assuming SQL Server):
SELECT text
FROM syscomments
WHERE id = (SELECT id FROM sysobjects WHERE name = '{0}')
ORDER BY colid
Execute this query from your app then concatenate the results.
Phil
2010-06-03 10:42:48
Work, but i get two row for my storedprocedure
Flatlineato
2010-06-03 10:57:50
@Flatlineato: how many rows were you expecting?
Phil
2010-06-03 12:19:05
@Phil: 1 stored 1 row instead query return 2 row, seems that the text is divided into two parts
Flatlineato
2010-06-03 21:57:57
@Flatlineato: Yes, the text may be divided into multiple parts. That's why you need to concatenate the results. You could use `String.Concat` or a `StringBuilder` - there are a lot of options.
Phil
2010-06-04 08:21:30
@Phil: Yes, no problem i just want to pointout
Flatlineato
2010-06-04 08:44:44