Friday, March 30, 2012
How to auto start mssql service in command line?
Could anyone tell, the way to automatically startup SQL
Server service and SQL Agent at mid-night in command line
in SQL Server 2000?
I tried to startup with command servr.exe in Binn
directory and seems like it stop the Launched startup
procedure 'sp_MScleanupmergepublisher'. How can I startup
SQL Server service without single user mode?
Thanks a lot.
-JennyMaybe:
net start mssqlserver
net start sqlserveragent
--
http://www.aspfaq.com/
(Reverse address to reply.)
"Jenny" <jyu@.iseoptions.com> wrote in message
news:428001c47325$f6b44510$a601280a@.phx.gbl...
> Hi,
> Could anyone tell, the way to automatically startup SQL
> Server service and SQL Agent at mid-night in command line
> in SQL Server 2000?
> I tried to startup with command servr.exe in Binn
> directory and seems like it stop the Launched startup
> procedure 'sp_MScleanupmergepublisher'. How can I startup
> SQL Server service without single user mode?
> Thanks a lot.
> -Jenny
>|||Hi,
NET START MSSQLSERVER
NETSTART SQLSERVERAGENT
Put the above commands inside a batch file and schedule to fire at midnight
using OS scheduler. If the service is already running then it will
give an error and exits.
Thanks
Hari
MCDBA
"Jenny" <jyu@.iseoptions.com> wrote in message
news:428001c47325$f6b44510$a601280a@.phx.gbl...
> Hi,
> Could anyone tell, the way to automatically startup SQL
> Server service and SQL Agent at mid-night in command line
> in SQL Server 2000?
> I tried to startup with command servr.exe in Binn
> directory and seems like it stop the Launched startup
> procedure 'sp_MScleanupmergepublisher'. How can I startup
> SQL Server service without single user mode?
> Thanks a lot.
> -Jenny
>|||"Jenny" <jyu@.iseoptions.com> wrote in message
news:428001c47325$f6b44510$a601280a@.phx.gbl...
> Hi,
> Could anyone tell, the way to automatically startup SQL
> Server service and SQL Agent at mid-night in command line
> in SQL Server 2000?
> I tried to startup with command servr.exe in Binn
> directory and seems like it stop the Launched startup
> procedure 'sp_MScleanupmergepublisher'. How can I startup
> SQL Server service without single user mode?
> Thanks a lot.
> -Jenny
>
In SQL 7.0 it was: net stop mssqlserver and net stop mssqlagent
I'll assume it's the same in SQL 2000, and it should be in Books On Line.
hth.
steve.sql
how to auto restart the merge agent
step 2 :
could not retrieve generation information at the 'Subscriber'. NOTE: The
step was retried the requested number of times (10) without succeeding. The
step failed.
step 3:
The merge agent job failed. The merge process could not retrieve generation
information at the 'Subscriber'. NOTE: The step was retried the requested
number of times (10) without succeeding. The step failed. [SQLSTATE 42000]
(Error 14151). The step failed.
I am not sure what had caused the merge agent to fail but after I restarted
the merge agent , it automatically caught up. I would like to know if there
is a way to automatically re-start the merge agent after the system restored.
Thanks in advance for any help.
Wen Chang
Wen,
I'm not too sure what you mean by setting it off when the system gets
restarted. If you mean have it keep trying, then you could loop the steps in
the merge agent's job. Alternatively you could have it run on a schedule and
not continuously - eg once each minute.
Cheers,
Paul Ibison SQL Server MVP, www.replicationanswers.com
(recommended sql server 2000 replication book:
http://www.nwsu.com/0974973602p.html)
How to auto increment with character + integer?
Can anyone help me? I have created a table and with a primary key called "ID".
However, I want the "ID" be auto increment as well.
Here is my question, how can I do in the following format:
"PIC0001", "PIC0002", "PIC0003", ......... etc.
Anyone can help me?
Thanks.You can create a calculated field as part of a view, using the number from the IDENTITY column appended to the string "PIC".
SELECT 'PIC' + REPLACE(STR(ID,4),' ','0') AS AlphaID|||i'm a rookie...can u explain more detail for this one pls? SELECT 'PIC' + REPLACE(STR(ID,4),' ','0') AS AlphaID|||SELECT 'PIC' + REPLACE(STR(ID,4),' ','0') AS AlphaID
'PIC' is the literal you apparently want at the beginning of the string. ID would be a column of type INT, set to IDENTITY. REPLACE(STR(ID,4),' ','0') takes an int number, like 12, and changes it to '0012', thus for a row with an ID of 12, you would get a column called AlphaID with a value of 'PIC0012'.|||hello
thank you for the support
you mean that i have to make two fields one called ID of type int and the other called alphaid
of type nchar and put the default value of this field as you say?
or i have to put the statment SELECT 'PIC' + REPLACE(STR(ID,4),' ','0') AS AlphaID in the code of the application?
thank you again for the help|||If the prefix is ALWAYS 'PIC', then I would just create a VIEW that has as part of it that SELECT statement. If it varies, then I would create the table with the ID field and the Prefix field, and then combine them in a view.|||You could also implement this as a computed column within the tabl itself.
This approach might add more overhead though, so it depends on how many of your selects would actually be accessing this field directly.
One potential advantage to having the value as a computed column is that, assuming the computed column meets certain criteria, you can index the column. If you are planning on retrieving rows based on this field, this could work to your advantage.|||Actually, given triggers, you could certainly create a "real" field to hold the value and have it populated in the trigger.|||But would you gain anything by going the trigger route? Wouldn't that just add overhead to your inserts? Or would the overhead be comparable to the overhead assiociated with a computed column (at least when maintaining an index on that computed column).
To my mind, it is a LOT easier to configure a computed column for this solution than it is to program a trigger. But, then again, I rarely use triggers, so I might not be the best resource here. All things being equal though (and I'm NOT saying they are; you might have a better idea than me on that one), I'd go with the solution that's easier to implement.|||Presuming the ID number part of the computed column never changes, you would need only an INSERT trigger. In most applications, the number of INSERTs vs. the number of SELECTs is very small, and so the overhead of doing the insert trigger is really small.
I certainly agree that often easier is better. I have not compared performance of these two solutions (though I would likely do a column fed by a trigger).|||I might suggest you use IDENTITY as PK and add 'PIC' and '000..' to the layer(s) that require it.
This is based on the presumption that PIC000n... is a (surrogate) PK with no "real" business meaning and using only int will make the key more efficient.|||I agree, to an extent. If multiple systems, or layers, might be touching this data, then it CAN add some consistency to be able to define this formatting in one central location.
While you could easily add this computed "key" as a property of a class, for example, you might then need to write numerous report which use this key; some might be Crystal reports, some SQL Server reporting services. Some might be generated ad hoc by the end user. IF this is a business-level way of identifying these records, I don't necessarily see a problem with allowing that identifying characteristic to be stored with the record itself.|||hello
thank you for the support
but can you give me more details about how can i do that?
thank you again for th help anf for the time|||Hi,
I have similar question, I have created a table and with a primary key called "ID".
However, I want the "ID" be auto increment as well.
Here is my question, how can I do in the following format:
"1", "2", "3", ......... etc.
Anyone can help me?
Thanks.|||If you just need numbers to autoincrement, set the column to be an IDENTITY column.
How to auto increment an alphanumeric Primary Key in SQL? :(
How to auto increment an alphanumeric Primary Key in SQL? :( Because I want to add something like this in the Primary Key, for example i'll add a new data with an alphanumeric value of ABC-0001, then I'll add another 1, and it auto increments to ABC-0002 and so on.. How can I do it? And if I'll add a new alpha character in the Primary Key field, for example DEF-0001, then I'll add another and it auto increments to 002, and so on, and it will go back to 0001 if i'll use another combination of alpha characters. for example, i'll add a new alpha character AAA, will it go back to 0001 or it will continue?
T___T I hope u get my point.. I want my table to look like this if i have added the data
ABC-0001
ABC-0002
DEF-0001
DEF-0002
AAA-0001
then if il add a new 1, for example ABC
it will auto increment to 0003 in the same field, it will look like this after adding
ABC-0001
ABC-0002
ABC-0003
DEF-0001
DEF-0002
AAA-0001
Will it be possible? :(
hi,
i got wat you wanted to say.but i think auotincrement is possible only with numeric fields,i cant think of any possible algorithm that would solve your problem for autoincrementing alphanumeric field.But one possible solution would be to generate your own primary key.For that to happen first you must split your Alpha-numeric field into two..ie first part will take ABC and second would take ur numeric field 0001 etc...
make your primary key as the combination of both the fields...this is the solution i could think of...
hope you could find,wat you actually wanted..all the best :)
Hey ranjit that's what im thinking off also... bat what if there's a new alpha combination, for example DEF, it will continue to autoincrement, and i think it will not return to 0001.. so what will happen is, if i have added ABC-0001 and ABC-0002, the next one would be
DEF-0003 not DEF-0001
will it be possible to put it back to 0001 if il add a new alpha combination? or very impossible? :(
T___T
to get the primary key... you have to findmax for that perticular string with Query sequence like...
SELECT MAX(CAST(SUBSTRING(id,CHARINDEX('-',id)+1,50) AS INT)) + 1 FROM TBL_Table WHEREID LIKE 'DEF%' [this can be like ..."id like 'ABC%' to get highest value in ABC Sequence].. hope it helps you..
wow thanks for this kaushal.. il try it out :)
How To Auto Increment A Primary ID Field?
I was just wondering on a very simple database table with lets say a primary key set to columb ID and another columb lets say products, can you make the primary key automaticly increment its self whenever a new entry has been put in?
For instance say I have this table set up with ID Being the primary KEY, Columb 1 = ID( INT ), Columb 2 = Products ( VarChar(50) ), and have the fields ID = 1, and products = my product....and if a user inserts a new record say from a gridview or some sort of data entry the second ID Feild will automaticly be 2 and the products gets updated per user input......I'm very sorry but I'm having a hard time putting this into words for some reason..
umm basicly user adds something into the products feild and the ID field automaticly increments one number higher from the last one?
Thanks
Adam.
On the ID column set identity=Yes, and the value will be assigned automatically!
HTH
|||OH MAN your joking right? LOL I must have overlooked something.....because at first I thought that was how you do it but I was not sure and I think I tried setting it to yes in the past but I must have overlooked the values that changed or something....maybe I was having an off day.....but thats perfect thank you so much...|||Actually sorry to bother you again by any change would you know if you can set a primary key and a foreign key inside the same table?|||This is why I needed my foregn key and primary key things to work...well at least my search's that I do point me in that direction.
I have a couple of listboxs where a user clicks on an option in parent listbox and the results come out on the child list box
Pritty much my problem is that when I use one table and several columbs the first ListBox (ListBox1) which only contained 6 Items had about 30 more Blank (Or Database NULL) fields after the 6 Selections....This was due because some fields were longer then others......The only way I've got around this is to create a different sql datasource for all selections which gives me 7 total sqldatasource on one particular page.....not a very smart coding practise lol...
How to authorize a user only through an application
we use Windows Authentification with SQL Server 2005 but we want our users
to access to the database only with an application. We don't want our users
to access to the database with an other application.
What are the possibilities ? Does SQL Server recognize an application with a
signature or something like that ?
Thanks
Best regardsCheck in Books On Line about the use of an 'Application Role'.
An 'Application Role' is a special type of login that may work for your
situation.
Arnie Rowland, Ph.D.
Westwood Consulting, Inc
Most good judgment comes from experience.
Most experience comes from bad judgment.
- Anonymous
"Jojonews" <Jojonews@.discussions.microsoft.com> wrote in message
news:46345D65-7404-40EE-BECE-BED51AEC45B1@.microsoft.com...
> Hello,
> we use Windows Authentification with SQL Server 2005 but we want our users
> to access to the database only with an application. We don't want our
> users
> to access to the database with an other application.
> What are the possibilities ? Does SQL Server recognize an application with
> a
> signature or something like that ?
> Thanks
> Best regardssql
How to author reports for Reporting Services?
I can create RDL files using Visual Studio.NET, but like to offload this task to a minion who does not have VS.NET.
Is there a stripped down something-or-other to make reports that and end user or business analyst could use and then upload the reports?
Thanks.You might consider Soft Artisans'OfficeWriter. I personally don't have any experience using Reporting Services with OfficeWriter; I have only used their ExcelWriter product and was very pleased with both it and their customer service.
Terri