Showing posts with label sql2000. Show all posts
Showing posts with label sql2000. Show all posts

Sunday, March 11, 2012

"Stored Procedure" working every 5 minute, how?

hi
i working on SQL2000, and want to make "Stored Procedure" that's working
every 5 mibute, without making any calling.
how i can make that ?
--
Best Regards
Tark M. Siala
Development Manager
INTERNATIONAL COMPUTER CENTER (ICC.Networking)
Mobile: +218-91-3125900
E-Mail: tarksiala@.icc-libya.com
Messenger: tarksiala@.hotmail.com
Web Page: http://www.icc-libya.com
Blog: http://spaces.msn.com/tarksiala
======================================Hi Tark
You can set up a job to run the stored procedure on a 5-minute schedule.
Look up How To Create a Job.
(I also suggest you don't include quite so many newsgroups in your list.
What does this question have to do with clustering anyway? You included the
msde group also, does that mean you are running on msde? If so, you should
say that.)
HTH
Kalen Delaney, SQL Server MVP
www.solidqualitylearning.com
"Tark Siala" <tarksiala@.icc-libya.com> wrote in message
news:eH4GDSyXGHA.3936@.TK2MSFTNGP05.phx.gbl...
> hi
> i working on SQL2000, and want to make "Stored Procedure" that's working
> every 5 mibute, without making any calling.
> how i can make that ?
> --
> Best Regards
> Tark M. Siala
> Development Manager
> INTERNATIONAL COMPUTER CENTER (ICC.Networking)
> Mobile: +218-91-3125900
> E-Mail: tarksiala@.icc-libya.com
> Messenger: tarksiala@.hotmail.com
> Web Page: http://www.icc-libya.com
> Blog: http://spaces.msn.com/tarksiala
> ======================================
>
>

Saturday, February 25, 2012

"Net Send" from SQL2000 on Windows 2003.

Hi all.
The following command don't work on ours SQL server anymore. Not sure why,
but could it be that the command "Net Send" is removed for NT 2000?
Any ideas.
Thanks
Geir
DECLARE @.Message varchar(255)
Set @.Message = 'net send USER Message to OLNY from SAM : . TEST, TEST, Price
to low!. Order 6555 '
EXEC master.. xp_cmdshell @.Message, no_outputHi
Is your SQL Server Service Account a Domain account? If not, change it to a
domain account.
Regards
--
Mike Epprecht, Microsoft SQL Server MVP
Zurich, Switzerland
IM: mike@.epprecht.net
MVP Program: http://www.microsoft.com/mvp
Blog: http://www.msmvps.com/epprecht/
"Geir Holme" <geir@.multicase.no> wrote in message
news:%23lrHkVOxFHA.3720@.TK2MSFTNGP11.phx.gbl...
> Hi all.
> The following command don't work on ours SQL server anymore. Not sure why,
> but could it be that the command "Net Send" is removed for NT 2000?
> Any ideas.
> Thanks
> Geir
> DECLARE @.Message varchar(255)
> Set @.Message = 'net send USER Message to OLNY from SAM : . TEST, TEST,
> Price to low!. Order 6555 '
> EXEC master.. xp_cmdshell @.Message, no_output
>|||Hi
See this example written by Tibor
USE master
GO
CREATE PROC sp_dbm_notify_users @.msg VARCHAR(255) AS
/ ****************************************
***********************************
****/
/* This procedure does a NET SEND to all connected computers.
*/
/* Requires that the messenger service is running on the client.
*/
/* The bat file is a sample showing how a message can be sent from the OS.
A */
/* shortcut to the bat file can be placed on the desktop, for instance
*/
/* The procedure takes the following parameter:
*/
/* @.msg VARCHAR(255) (required): The message to be sent
*/
/* Written by Tibor Karaszi and Brje Carlsson 1999. www.dbmaint.com
*/
/* Tested on verion 6.5, 7.0 and 8.0.
*/
/ ****************************************
***********************************
****/
SET NOCOUNT ON
--Get version number and verify supported version
DECLARE @.ver VARCHAR(7)
SELECT @.ver = CASE
WHEN CHARINDEX('6.50', @.@.VERSION) > 0 THEN '6.50'
WHEN CHARINDEX('7.00', @.@.VERSION) > 0 THEN '7.00'
WHEN CHARINDEX('8.00', @.@.VERSION) > 0 THEN '8.00'
ELSE 'Unknown'
END
IF @.ver = 'Unknown'
BEGIN
RAISERROR('Unsupported version of SQL Server.',16,1)
RETURN -101
END
--Declare variables section
DECLARE loop_name INSENSITIVE CURSOR FOR
SELECT DISTINCT LTRIM(RTRIM(hostname))
FROM master..sysprocesses
WHERE DATALENGTH(LTRIM(RTRIM(hostname))) > 0
OPEN loop_name
DECLARE @.host_name VARCHAR(30)
DECLARE @.exec_str VARCHAR(255)
FETCH NEXT FROM loop_name INTO @.host_name
WHILE (@.@.fetch_status = 0)
BEGIN
SELECT @.exec_str = 'master..xp_cmdshell "NET SEND ' + @.host_name + ' '
+ @.msg + '"'
EXEC( @.exec_str)
FETCH NEXT FROM loop_name INTO @.host_name
END
DEALLOCATE loop_name
GO
/* Sample Execution:
EXEC sp_dbm_notify_users 'SQL Server will shut down in 30 minutes!'
*/

"Geir Holme" <geir@.multicase.no> wrote in message
news:%23lrHkVOxFHA.3720@.TK2MSFTNGP11.phx.gbl...
> Hi all.
> The following command don't work on ours SQL server anymore. Not sure why,
> but could it be that the command "Net Send" is removed for NT 2000?
> Any ideas.
> Thanks
> Geir
> DECLARE @.Message varchar(255)
> Set @.Message = 'net send USER Message to OLNY from SAM : . TEST, TEST,
> Price to low!. Order 6555 '
> EXEC master.. xp_cmdshell @.Message, no_output
>|||it's possible that your messenger service may be shut down (check start ->
run-> services.msc -> messenger).
Regards,
Mary
"Geir Holme" <geir@.multicase.no> wrote in message
news:%23lrHkVOxFHA.3720@.TK2MSFTNGP11.phx.gbl...
> Hi all.
> The following command don't work on ours SQL server anymore. Not sure why,
> but could it be that the command "Net Send" is removed for NT 2000?
> Any ideas.
> Thanks
> Geir
> DECLARE @.Message varchar(255)
> Set @.Message = 'net send USER Message to OLNY from SAM : . TEST, TEST,
> Price to low!. Order 6555 '
> EXEC master.. xp_cmdshell @.Message, no_output
>

Thursday, February 16, 2012

"File not in a recognizeable format" when rendering to excel

I am using a WinXP SP2 machine with SQL2000 SP4, and using Reporting
Services SP2 when I get "File not in a recognizeable format" when
rendering to excel. Same goes for trying to render to PDF.
The weird thing is that on a virtual I have with Reporting Services
RTM, the excel opens fine...so I don't know what is going on.
The way I am generating the report is by manually creating a
request/response, adding on the POST vars, and then writing the output
to the browser (changing the content-type to excel, pdf, etc). As I
said, with the RTM version, the excel generates fine, but with SP2 it
doesnt.
Here are the parameters that I am adding onto the URL when I make the
request, along with my custom params.
//SQL REPORTING SERVICES SPECIAL PARAMS
sb.Append("&rs:Command=Render");
sb.Append("&rs:Format=" + exportType);
sb.Append("&rc:Parameters=false");
sb.Append("&rc:Toolbar=false&rs:Encoding=ASCII&rc:NoHeader=true");
I then I generate and return the request with the code below
(GeneratePostData() basically just creates the POST vars from above)
public static string generateReport(string url)
{
String result = "";
//get the data to post.
string postData = GeneratePostData();
System.IO.StreamWriter myWriter = null;
HttpWebRequest objRequest = (HttpWebRequest)WebRequest.Create(url);
objRequest.PreAuthenticate = true;
// Way 1:
//objRequest.Credentials = CredentialCache.DefaultCredentials;
// Way 2:
objRequest.Credentials = new
NetworkCredential(REPORT_USER,REPORT_PASS,REPORT_DOMAIN);
objRequest.Method = "POST";
objRequest.ContentLength = postData.Length;
objRequest.ContentType = "application/x-www-form-urlencoded";
try
{
myWriter = new
System.IO.StreamWriter(objRequest.GetRequestStream());
myWriter.Write(postData);
}
catch (Exception e)
{
return e.Message;
}
finally
{
myWriter.Close();
}
try
{
HttpWebResponse objResponse = (HttpWebResponse)objRequest.GetResponse();
using(System.IO.StreamReader sr = new
System.IO.StreamReader(objResponse.GetResponseStream()) )
{
result = sr.ReadToEnd();
// Close and clean up the StreamReader
sr.Close();
}
}
catch (Exception e)
{
return "An error occured while generating your report.\n" +
e.Message;
}
return result;
}
anyone have any ideas/things I can try because I am at a loss. Thanks
in advance.I figured out my problem.
I was taking the stream reader and passing the results back to the
output stream and writing it out just using Response.Write. This
worked fine for Reporting Svcs RTM, but NOT for SP2.
After going through various postings, I gather a few ways that others
did similar web request/response calls and found that if I just passed
the raw response stream and wrote it out with
Response.outputstream.write that it worked for BOTH RTM and SP2..
System.IO.Stream rs =ReportBuilder.generateReportStream(ReportBuilder.ReportViewerFullPath);
Byte[] read = new Byte[1024];
int count = rs.Read(read, 0, read.Length);
while(count > 0)
{
Response.OutputStream.Write(read, 0, count);
count = rs.Read(read, 0, count);
}