Sunday, March 25, 2012
Archive SQL Server Logs..?
is anyone knows that how can i archive(delete) log file for current date or
specific date'?
Thanx in advance
regards
--
Message posted via http://www.sqlmonster.comHi,
Did you mean SQL Server error logs or Tranasction log backups?
If it is Error log, sql server by itself keep only 6+1 (current) copies by
default. The old files will be deleted automatically.
If it is Transaction log backup files, then use database maintenance plan to
fix a archival day. So as old file(s) will be deleted automatically.
Thanks
Hari
SQL Server MVP
"sonny singh via SQLMonster.com" <forum@.nospam.SQLMonster.com> wrote in
message news:fa2cf9e684d741419c1094db51a9fea5@.SQLMonster.com...
> Hi Folks
> is anyone knows that how can i archive(delete) log file for current date
> or
> specific date'?
> Thanx in advance
> regards
> --
> Message posted via http://www.sqlmonster.com|||Hi Hari
You can change the number of error logs maintained by editing the Registry
for any instance. For the default instance, find the key
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSSQLServer\MSSQLServer and edit it by
adding a new value. Define the value with the name NumErrorLogs, and the
type REG_DWORD. Supply any initial value desired, but keep in mind that the
value you enter when editing the Registry will be in hexadecimal format.
For a named instance, you need to find the key
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\<SQL Server
Instance Name>\MSSQLServer. Again, use the Edit feature of the Registry to
add a new value with the name NumErrorLogs of type REG_DWORD, and supply an
initial value in hexadecimal format.
--
HTH
--
Kalen Delaney
SQL Server MVP
www.SolidQualityLearning.com
"Hari Prasad" <hari_prasad_k@.hotmail.com> wrote in message
news:Os1pMt2bFHA.3712@.TK2MSFTNGP09.phx.gbl...
> Hi,
> Did you mean SQL Server error logs or Tranasction log backups?
> If it is Error log, sql server by itself keep only 6+1 (current) copies by
> default. The old files will be deleted automatically.
> If it is Transaction log backup files, then use database maintenance plan
> to fix a archival day. So as old file(s) will be deleted automatically.
> Thanks
> Hari
> SQL Server MVP
> "sonny singh via SQLMonster.com" <forum@.nospam.SQLMonster.com> wrote in
> message news:fa2cf9e684d741419c1094db51a9fea5@.SQLMonster.com...
>> Hi Folks
>> is anyone knows that how can i archive(delete) log file for current date
>> or
>> specific date'?
>> Thanx in advance
>> regards
>> --
>> Message posted via http://www.sqlmonster.com
>
Thursday, March 22, 2012
Arbitrary assignment in join
r :-)
I am migrating data that has some grouping, but I there is not a unque join
to get a 1-1 match for
my data. What I need to to simply pick any *one* row and put it in any *one
* row in my destination
table.
Here is the issue in SQL:
create table T1
(
grp varchar(5), -- some grouping
k1 int -- some unique key in T1
)
create table T2
(
grp varchar(5), -- some grouping
k2 int -- some unique key in T2
)
insert T1 (grp, k1) values ('A', 1)
insert T1 (grp, k1) values ('A', 2)
insert T1 (grp, k1) values ('B', 3)
insert T1 (grp, k1) values ('B', 4)
insert T2 (grp, k2) values ('A', 100)
insert T2 (grp, k2) values ('A', 101)
insert T2 (grp, k2) values ('B', 102)
select T1.grp, T1.k1, T2.k2
from T1
inner join T2 on T2.grp = T1.grp
order by T1.grp, T1.k1, T2.k2
The last select gives me this result:
A 1 100
A 1 101
A 2 100
A 2 101
B 3 102
B 4 102
In the above, I have duplicates (A-1 matches with both 100 and 101, so does
A-2). I don't care
which way I get them, I just need to match them up and get each record in T2
once and only once. A
good result (but not the only) would be:
A 1 100
A 2 101
B 4 102
In this example, I only have one row in T2 for group B, so I can assign it t
o B-3 or B-4 in T1, it
doesn't matter to me.
Is there a clever way to join this to get the desired result? I should be a
ble to do it with a
cursor, but it is pretty far down my list of alternatives :-)
Thanks!Here's a deterministic solution which matches rows based on key order within
the group:
select t1.grp, k1, k2
from t1 join t2
on t1.grp = t2.grp
and (select count(*) from t1 as t1b
where t1b.grp = t1.grp and t1b.k1 <= t1.k1) =
(select count(*) from t2 as t2b
where t2b.grp = t2.grp and t2b.k2 <= t2.k2)
It's pretty fast if the group size is fairly small (only several rows in a
group), and you have an index on (grp, key).
If the group size is large (dozens and up), it will be even slower than a
cursor-based solution.
In such a case, a fast solution would be to populate temporary tables with
identity values like so:
create table #T1
(
rn int not null identity,
grp varchar(5),
k1 int
)
create table #T2
(
rn int not null identity,
grp varchar(5),
k2 int
)
insert into #t1(grp, k1)
select * from t1
order by grp, rand(checksum(newid()))
insert into #t2(grp, k2)
select * from t2
order by grp, rand(checksum(newid()))
select t1.grp, k1, k2
from (select rn - mnrn + 1 as rn, t.grp, t.k1
from #t1 as t
join (select grp, min(rn) as mnrn from #t1 group by grp) as g
on t.grp = g.grp) as t1
join
(select rn - mnrn + 1 as rn, t.grp, t.k2
from #t2 as t
join (select grp, min(rn) as mnrn from #t2 group by grp) as g
on t.grp = g.grp) as t2
on t1.grp = t2.grp
and t1.rn = t2.rn
grp k1 k2
-- -- --
A 1 101
A 2 100
B 4 102
I used random sorting within the group to generate row numbers, but if you
want a deterministic result, simply sort by grp, key.
Cheers,
--
BG, SQL Server MVP
www.SolidQualityLearning.com
"Jami Bradley" <jbradley@.isa-og.com> wrote in message
news:cm87f1tvutjsom61a8151uq74mmfi6f6f1@.
4ax.com...
> Hi folks - I'm hoping that this is an issue that has a reasonably easy
> answer :-)
> I am migrating data that has some grouping, but I there is not a unque
> join to get a 1-1 match for
> my data. What I need to to simply pick any *one* row and put it in any
> *one* row in my destination
> table.
> Here is the issue in SQL:
> create table T1
> (
> grp varchar(5), -- some grouping
> k1 int -- some unique key in T1
> )
>
> create table T2
> (
> grp varchar(5), -- some grouping
> k2 int -- some unique key in T2
> )
> insert T1 (grp, k1) values ('A', 1)
> insert T1 (grp, k1) values ('A', 2)
> insert T1 (grp, k1) values ('B', 3)
> insert T1 (grp, k1) values ('B', 4)
> insert T2 (grp, k2) values ('A', 100)
> insert T2 (grp, k2) values ('A', 101)
> insert T2 (grp, k2) values ('B', 102)
>
> select T1.grp, T1.k1, T2.k2
> from T1
> inner join T2 on T2.grp = T1.grp
> order by T1.grp, T1.k1, T2.k2
>
> The last select gives me this result:
> A 1 100
> A 1 101
> A 2 100
> A 2 101
> B 3 102
> B 4 102
> In the above, I have duplicates (A-1 matches with both 100 and 101, so
> does A-2). I don't care
> which way I get them, I just need to match them up and get each record in
> T2 once and only once. A
> good result (but not the only) would be:
> A 1 100
> A 2 101
> B 4 102
> In this example, I only have one row in T2 for group B, so I can assign it
> to B-3 or B-4 in T1, it
> doesn't matter to me.
>
> Is there a clever way to join this to get the desired result? I should be
> able to do it with a
> cursor, but it is pretty far down my list of alternatives :-)
>
> Thanks!
>|||Is this what you want?
select T2.grp, T2.k2, min(T1.k1) as k1
from T1 join T2 on (T1.grp = T2.grp)
group by T2.grp, T2.k2
"Jami Bradley" <jbradley@.isa-og.com> wrote in message
news:cm87f1tvutjsom61a8151uq74mmfi6f6f1@.
4ax.com...
> Hi folks - I'm hoping that this is an issue that has a reasonably easy
answer :-)
> I am migrating data that has some grouping, but I there is not a unque
join to get a 1-1 match for
> my data. What I need to to simply pick any *one* row and put it in any
*one* row in my destination
> table.
> Here is the issue in SQL:
> create table T1
> (
> grp varchar(5), -- some grouping
> k1 int -- some unique key in T1
> )
>
> create table T2
> (
> grp varchar(5), -- some grouping
> k2 int -- some unique key in T2
> )
> insert T1 (grp, k1) values ('A', 1)
> insert T1 (grp, k1) values ('A', 2)
> insert T1 (grp, k1) values ('B', 3)
> insert T1 (grp, k1) values ('B', 4)
> insert T2 (grp, k2) values ('A', 100)
> insert T2 (grp, k2) values ('A', 101)
> insert T2 (grp, k2) values ('B', 102)
>
> select T1.grp, T1.k1, T2.k2
> from T1
> inner join T2 on T2.grp = T1.grp
> order by T1.grp, T1.k1, T2.k2
>
> The last select gives me this result:
> A 1 100
> A 1 101
> A 2 100
> A 2 101
> B 3 102
> B 4 102
> In the above, I have duplicates (A-1 matches with both 100 and 101, so
does A-2). I don't care
> which way I get them, I just need to match them up and get each record in
T2 once and only once. A
> good result (but not the only) would be:
> A 1 100
> A 2 101
> B 4 102
> In this example, I only have one row in T2 for group B, so I can assign it
to B-3 or B-4 in T1, it
> doesn't matter to me.
>
> Is there a clever way to join this to get the desired result? I should be
able to do it with a
> cursor, but it is pretty far down my list of alternatives :-)
>
> Thanks!
>|||Beautiful - works great! I still keep forgetting those tricks with count(*)
to match up the items.
I was starting down the path of the second choice with the temp tables and i
dentity. I think the
largest group size I will be seeing is 8-10, so I think the first query will
work well.
Thanks for the help!
Jami
On Fri, 5 Aug 2005 21:04:16 +0300, "Itzik Ben-Gan" <itzik@.REMOVETHIS.SolidQu
alityLearning.com>
wrote:
>Here's a deterministic solution which matches rows based on key order withi
n
>the group:
>select t1.grp, k1, k2
>from t1 join t2
> on t1.grp = t2.grp
> and (select count(*) from t1 as t1b
> where t1b.grp = t1.grp and t1b.k1 <= t1.k1) =
> (select count(*) from t2 as t2b
> where t2b.grp = t2.grp and t2b.k2 <= t2.k2)
>It's pretty fast if the group size is fairly small (only several rows in a
>group), and you have an index on (grp, key).
>If the group size is large (dozens and up), it will be even slower than a
>cursor-based solution.
>In such a case, a fast solution would be to populate temporary tables with
>identity values like so:
>create table #T1
>(
> rn int not null identity,
> grp varchar(5),
> k1 int
> )
>create table #T2
>(
> rn int not null identity,
> grp varchar(5),
> k2 int
> )
>insert into #t1(grp, k1)
> select * from t1
> order by grp, rand(checksum(newid()))
>insert into #t2(grp, k2)
> select * from t2
> order by grp, rand(checksum(newid()))
>select t1.grp, k1, k2
>from (select rn - mnrn + 1 as rn, t.grp, t.k1
> from #t1 as t
> join (select grp, min(rn) as mnrn from #t1 group by grp) as g
> on t.grp = g.grp) as t1
> join
> (select rn - mnrn + 1 as rn, t.grp, t.k2
> from #t2 as t
> join (select grp, min(rn) as mnrn from #t2 group by grp) as g
> on t.grp = g.grp) as t2
> on t1.grp = t2.grp
> and t1.rn = t2.rn
>grp k1 k2
>-- -- --
>A 1 101
>A 2 100
>B 4 102
>I used random sorting within the group to generate row numbers, but if you
>want a deterministic result, simply sort by grp, key.
>Cheers,|||Not quite. That gives me a duplicate copy of k1 = 1, so I will lose the row
where k1 = 2.
Thanks!
Jami
On Fri, 5 Aug 2005 15:19:23 -0400, "Brian Selzer" <brian@.selzer-software.com
> wrote:
>Is this what you want?
>select T2.grp, T2.k2, min(T1.k1) as k1
> from T1 join T2 on (T1.grp = T2.grp)
> group by T2.grp, T2.k2
>"Jami Bradley" <jbradley@.isa-og.com> wrote in message
> news:cm87f1tvutjsom61a8151uq74mmfi6f6f1@.
4ax.com...
>answer :-)
>join to get a 1-1 match for
>*one* row in my destination
>does A-2). I don't care
>T2 once and only once. A
>to B-3 or B-4 in T1, it
>able to do it with a
>
Monday, March 19, 2012
Applying MS05-003 broke something...
running MS SQLServer 2000 SP3. On doing this, certain data uploads began to
fail. Once this patch was removed, things began working again. Is there a
known issue with this patch? Has anyone else run across a similar issue? If
so, can someone suggest a work-around or other solution?
Thank you.
Daniel.Please confirm the patch you have installed/un-installed.
MS05-003 is not KB871259
http://www.microsoft.com/technet/se...n/MS05-003.mspx
is 871250.
This patch affect the Indexing Service and replaces the following file on
Win2k
Ciodm.dll
5.0.2195.6981
05-Nov-2004
04:41
68,880
Thanks,
Kevin McDonnell
Microsoft Corporation
This posting is provided AS IS with no warranties, and confers no rights.|||Kevin,
My bad. I typoed. The patch applied is MS05-003 / 871250.
Suggestions or known issues?
Daniel.
"Kevin McDonnell [MSFT]" wrote:
> Please confirm the patch you have installed/un-installed.
> MS05-003 is not KB871259
> http://www.microsoft.com/technet/se...n/MS05-003.mspx
> is 871250.
> This patch affect the Indexing Service and replaces the following file on
> Win2k
> Ciodm.dll
> 5.0.2195.6981
> 05-Nov-2004
> 04:41
> 68,880
>
> Thanks,
> Kevin McDonnell
> Microsoft Corporation
> This posting is provided AS IS with no warranties, and confers no rights.
>
>|||I'm not aware of this particular patch affecting SQL Server, since we're
patching the Indexing Service.
The Indexing Service is a base service for MicrosoftWindows 2000 or later
that extracts content from files and constructs an indexed catalog to
facilitate efficient and rapid searching. It is used for local searching
and can also be utilized on an IIS Web server to search remotely (with
custom web application code)
Please confirm that removing the patch allows your SQL Server to function
correctly. Open up a case with us if you're able to reproduce the problem.
Thanks,
Kevin McDonnell
Microsoft Corporation
This posting is provided AS IS with no warranties, and confers no rights.|||"Kevin McDonnell [MSFT]" wrote:[vbcol=seagreen]
> Please confirm that removing the patch allows your SQL Server to function
> correctly. Open up a case with us if you're able to reproduce the problem.[/vbcol
]
Kevin, Confirmed. As for "opening a case", I'd appreciate just a little
direction on exactly how to do that. I have looked with little success on th
e
web site and nothing just jumps out and shouts "log a case here". Clues are
sufficient (ususally).
d.|||Call Support Customer Care:
1-800-936-3500 (U.S. and Canada Only)
Thanks,
Kevin McDonnell
Microsoft Corporation
This posting is provided AS IS with no warranties, and confers no rights.
Thursday, March 8, 2012
Application SQL Server installing problems
Managed to loose my SQL Server while uninstalling application and now the
server doesn't get installed while trying to run the application installer
again. Is there any way to locate traces of the old installation anyhow...
or what could be the case.
Is it possible to trace down for example C:\Program Files\Microsoft SQL
Server\80\Tools\Binn\sqlmangr.exe for example if the registry settings have
somehow been vanished?
After the uninstallation and regcleaning traces of SQL were hanging still
for example in the XP Home Services prompt.
Thanks
http://support.microsoft.com/default...b;en-us;290991
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"Kaide" <kai.porvali@.kotiportti.fi> wrote in message news:OVDn0mbqFHA.4072@.TK2MSFTNGP09.phx.gbl...
> Hello Folks,
> Managed to loose my SQL Server while uninstalling application and now the
> server doesn't get installed while trying to run the application installer
> again. Is there any way to locate traces of the old installation anyhow...
> or what could be the case.
> Is it possible to trace down for example C:\Program Files\Microsoft SQL
> Server\80\Tools\Binn\sqlmangr.exe for example if the registry settings have
> somehow been vanished?
> After the uninstallation and regcleaning traces of SQL were hanging still
> for example in the XP Home Services prompt.
> Thanks
>
>
>
|||Thanks for your reply!
While editing values used, by Murphy, Regedit in the first faze. Is there
anything that could be done anymore or do I have to reinstall XP again.
Forgot to tell you that the first problems started after running repair
installation of XP. SQL just quit responding.
Best Regards!
Kaide
"Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> kirjoitti
viestiss:O4ZiyrgqFHA.2968@.TK2MSFTNGP10.phx.gbl... [vbcol=seagreen]
> http://support.microsoft.com/default...b;en-us;290991
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
> Blog: http://solidqualitylearning.com/blogs/tibor/
>
> "Kaide" <kai.porvali@.kotiportti.fi> wrote in message
> news:OVDn0mbqFHA.4072@.TK2MSFTNGP09.phx.gbl...
|||Not sure what you are saying. Do you want to remove all traces of SQL Server so you can install SQL
Server again? If so, the link I posted should help you.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"Kaide" <kai.porvali@.kotiportti.fi> wrote in message news:OBkdQ79qFHA.2244@.tk2msftngp13.phx.gbl...
> Thanks for your reply!
> While editing values used, by Murphy, Regedit in the first faze. Is there anything that could be
> done anymore or do I have to reinstall XP again. Forgot to tell you that the first problems
> started after running repair installation of XP. SQL just quit responding.
> Best Regards!
> Kaide
> "Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> kirjoitti
> viestiss:O4ZiyrgqFHA.2968@.TK2MSFTNGP10.phx.gbl...
>
|||Yes Tibor, and Thank You!
"Haste takes pleasure out of everything"! like they say. Respectivly, I
posted my question without checking all details...
Got server running after removing all known instances of the SQL and
reinstalling the application. I'm happy with the result that has bothered me
a lot during the last weeks.
Thanks' for your help once more! Even the software supplier couldn't help
with this issue even they got all info needed. (And this "Pineapple" company
should have a good customer support)!
Best Regards
"Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> kirjoitti
viestiss:uWBRKM%23qFHA.4044@.TK2MSFTNGP09.phx.gbl. ..
> Not sure what you are saying. Do you want to remove all traces of SQL
> Server so you can install SQL Server again? If so, the link I posted
> should help you.
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
> Blog: http://solidqualitylearning.com/blogs/tibor/
>
> "Kaide" <kai.porvali@.kotiportti.fi> wrote in message
> news:OBkdQ79qFHA.2244@.tk2msftngp13.phx.gbl...
>
|||Top paraphrase another saying: "KB is your friend". :-)
Glad you sorted it.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"Kaide" <kai.porvali@.kotiportti.fi> wrote in message news:OEHCnT$qFHA.3096@.TK2MSFTNGP15.phx.gbl...
> Yes Tibor, and Thank You!
> "Haste takes pleasure out of everything"! like they say. Respectivly, I posted my question without
> checking all details...
> Got server running after removing all known instances of the SQL and reinstalling the application.
> I'm happy with the result that has bothered me a lot during the last weeks.
> Thanks' for your help once more! Even the software supplier couldn't help with this issue even
> they got all info needed. (And this "Pineapple" company should have a good customer support)!
> Best Regards
>
> "Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> kirjoitti
> viestiss:uWBRKM%23qFHA.4044@.TK2MSFTNGP09.phx.gbl. ..
>
|||Hello once more,
Hmm... KB is short for what... lacking a one letter propably?
Kaide
"Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> kirjoitti
viestiss:%23%23ahJ%23$qFHA.240@.tk2msftngp13.phx.g bl...
> Top paraphrase another saying: "KB is your friend". :-)
> Glad you sorted it.
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
> Blog: http://solidqualitylearning.com/blogs/tibor/
>
> "Kaide" <kai.porvali@.kotiportti.fi> wrote in message
> news:OEHCnT$qFHA.3096@.TK2MSFTNGP15.phx.gbl...
>
|||KB = KnowledgeBase :-)
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Kaide" <kai.porvali@.kotiportti.fi> wrote in message news:%23$TUGRCrFHA.3736@.TK2MSFTNGP10.phx.gbl...
> Hello once more,
> Hmm... KB is short for what... lacking a one letter propably?
> Kaide
> "Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> kirjoitti
> viestiss:%23%23ahJ%23$qFHA.240@.tk2msftngp13.phx.g bl...
>
Sunday, February 12, 2012
API calls from within a Stored Procedure?
a
is to read file names out of a database and copy them from their current
location to specified directories. Can an API call be made from a SP to
prompt for a root directior (via file dialog), create a directory, and copy
a
file as its steping through a record set?
Suggestions will be greatly appreciated on how to do this.You can use extended stored procedures, although I believe you're not
supposed to have any UI on an XP. You could write a stored proc to read the
filenames from your database, and take advantage of the xp_cmdshell stored
procedure to move them to a destination directory. UI implementation is
really a whole 'nother layer from SQL Server, and you'd probably do better
to write a little .NET or other program to select the directory; although
you could create a stored proc to do the actual copy for you.
"Crisp" <Crisp@.discussions.microsoft.com> wrote in message
news:5E816E07-01D6-43F6-8E6C-E54E02BDB943@.microsoft.com...
> Folks, I would like to convert some macros into a stored procedure. The
> idea
> is to read file names out of a database and copy them from their current
> location to specified directories. Can an API call be made from a SP to
> prompt for a root directior (via file dialog), create a directory, and
> copy a
> file as its steping through a record set?
> Suggestions will be greatly appreciated on how to do this.|||You want to use SQL Server to move files around ?
including prompting a user for input?
This would be a gross misuse of the tool, it would be more appropriate and
much easier to do this in any ordinary programming language. You can still
put the file list in SQL if you want, and have application code get the list
from the SQL database, but having SQL do the File operations, or prompt user
s
for input, would be much too difficult, and inappropriate.
In fact, the only solution I can think of, is really a combination of having
SQL kick off an external process that does the actual "prompting and gather
user input" function, and then does the FIle IO... to do that you need to
write a COM-Component tool in a COM-Capable language, and call it from SQL
using built-in specially designed System procesdures. (Investigate the set
of built-in Stored Procs called sp_OACreate, sp_OAMethod, etc. that allow
you to create, use, and destroy COM components from inside SQL.)
But don't use these for any application where scaleability is a concern,
because they are notoriously NOT scaleable.
"Crisp" wrote:
> Folks, I would like to convert some macros into a stored procedure. The i
dea
> is to read file names out of a database and copy them from their current
> location to specified directories. Can an API call be made from a SP to
> prompt for a root directior (via file dialog), create a directory, and cop
y a
> file as its steping through a record set?
> Suggestions will be greatly appreciated on how to do this.|||I agree with you that the user input function and prompting would be a
misuse of SQL Server. The OP didn't specify this, but I was thinking along
the lines of administering the file move from a client machine? I.e., on my
desktop computer I want to move files on my SQL Server from C:\test_data to
D:\new_data. SQL Server makes it relatively easy to get a directory listing
and perform command shell operations via extended proc's, without setting up
and administering shares all over your network, or creating your own
specialized client/server app.
"CBretana" <cbretana@.areteIndNOSPAM.com> wrote in message
news:D04DB710-B550-4F04-A98D-19FA8F2B3688@.microsoft.com...
> You want to use SQL Server to move files around ?
> including prompting a user for input?
> This would be a gross misuse of the tool, it would be more appropriate and
> much easier to do this in any ordinary programming language. You can
> still
> put the file list in SQL if you want, and have application code get the
> list
> from the SQL database, but having SQL do the File operations, or prompt
> users
> for input, would be much too difficult, and inappropriate.
> In fact, the only solution I can think of, is really a combination of
> having
> SQL kick off an external process that does the actual "prompting and
> gather
> user input" function, and then does the FIle IO... to do that you need to
> write a COM-Component tool in a COM-Capable language, and call it from SQL
> using built-in specially designed System procesdures. (Investigate the
> set
> of built-in Stored Procs called sp_OACreate, sp_OAMethod, etc. that allow
> you to create, use, and destroy COM components from inside SQL.)
> But don't use these for any application where scaleability is a concern,
> because they are notoriously NOT scaleable.
>
> "Crisp" wrote:
>|||Well then it is certainly possible to write a SP that you would call from
your desktop, passing in acomplete source FileSpec, and destination FileSpec
,
as Local (Local to SQL Serevr) File Specfications, that would copy the file
from one folder \FileName to aspecified Folder\Filename... S(Sounds like yo
u
already know about xp_cmdShell)
You would still need to ensure that the Process ID the SQL Server was
running under had the appropriate permissions on the local file system.
The only thing this approach saves you is creating of user access
permissions and controlled network shares on the SQL Server across the
network...
"Michael C#" wrote:
> I agree with you that the user input function and prompting would be a
> misuse of SQL Server. The OP didn't specify this, but I was thinking alon
g
> the lines of administering the file move from a client machine? I.e., on
my
> desktop computer I want to move files on my SQL Server from C:\test_data t
o
> D:\new_data. SQL Server makes it relatively easy to get a directory listi
ng
> and perform command shell operations via extended proc's, without setting
up
> and administering shares all over your network, or creating your own
> specialized client/server app.
> "CBretana" <cbretana@.areteIndNOSPAM.com> wrote in message
> news:D04DB710-B550-4F04-A98D-19FA8F2B3688@.microsoft.com...
>
>|||"CBretana" <cbretana@.areteIndNOSPAM.com> wrote in message
news:12A44395-01F8-44C7-996E-EDAC39490BCF@.microsoft.com...
> Well then it is certainly possible to write a SP that you would call from
> your desktop, passing in acomplete source FileSpec, and destination
> FileSpec,
> as Local (Local to SQL Serevr) File Specfications, that would copy the
> file
> from one folder \FileName to aspecified Folder\Filename... S(Sounds like
> you
> already know about xp_cmdShell)
> You would still need to ensure that the Process ID the SQL Server was
> running under had the appropriate permissions on the local file system.
> The only thing this approach saves you is creating of user access
> permissions and controlled network shares on the SQL Server across the
> network...
Designated network shares restrict the OP's solution to copying files from
pre-defined Point A's to pre-defined Point B's, and he seemed to hint that
he wanted to be able to have a choice of source and destination; although
I'm not sure exactly how many choices he wants. For only one or two
destinations, the network shares solution would definitely be the way to go.
But if you know there are going to be a lot of sources and destinations,
like each user has his/her own set of source and destination folders, a more
dynamic approach might be needed. A front-end file selection utility like
the File Attach interface in EM is not that hard to create in VB.NET or
C#.NET using SQL Server xp's. I guess it all really depends on a more
specific set of requirements from the OP to decide what solution would be
best for his/her needs. I think we both agree that trying to use SQL Server
as a UI engine is a horrible idea.
Anyway to recover delete stored proc?
I screwed up big time, I deleted a very long and smart stored proc (pls
don't ask how).
Is there anyway I can recover it?
Any advice appreciated.
Tada.KoliPoki (rayone@.gmail.com) writes:
> I screwed up big time, I deleted a very long and smart stored proc (pls
> don't ask how).
> Is there anyway I can recover it?
Do you have a backup of the database? Or do you run the database with
full or bulk-logged recovery? In that case you might be able to.
If you don't have any backup and run with simple recovery, the procedure
has left for outer space.
Generally, all source code should be under version control. See the
database as the place where you have the binary representation of
the source.
--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp