|
You can write valid TSQL in different steps of your SQL jobs. In Enterprise Manager navigate to database server->Management->SQL Server Agent->Jobs and define a new backup job.
For example, I have a back up job defined in EM with one step having following code.
Declare @fileName nvarchar(250)
Set @fileName = N'C:\DBDailyBackup' + Replace(Replace(Replace(Convert(nvarchar(50), GetDate(), 20), ':', ''), ' ', ''), '-', '') + '.bak'
BACKUP DATABASE [pubs] TO DISK = @fileName WITH NOINIT , NOUNLOAD , NAME = N'pubs backup', NOSKIP , STATS = 10, NOFORMAT
You can also do it from Right click context menu on your database, choose All Tasks->Backup Database and define as schedule. Needless to say that you have to have SQL Agent service running for it to work properly.
Farhan Noor Qureshi
if (this == this) thow this;
|
|
|
|
|
Thanks For ur Solution
But I want To do It Through Enterprises Manager in Sql Server 2000. How We change the filename with Current date
Manoj
|
|
|
|
|
i need to create a SQL query in my C# code,
serching for all selected control voices.
I have 3 or more controlls (combobox)
If the user select a voice for the first and third one for example i need to create a query made like this:
Select * from myTable where...
Value N = ComboBoxN Selected Voice
loop
i've tried but i doesn't work.
If i try a multiple join yes, but how can i realize it?
|
|
|
|
|
Your question doesn't make any sense to me. However, perhaps this is what you are looking for:
SELECT * FROM MyTable
WHERE (someColumn = @comboBox1Value AND @comboBox1Value IS NOT NULL)
OR (someColumn = @comboBox2Value AND @comboBox2Value IS NOT NULL)
OR (someColumn = @comboBox3Value AND @comboBox3Value IS NOT NULL)
My: Blog | Photos
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucious
|
|
|
|
|
Hello,
I have a table called customer. I have other tables, but they are not important regards to this question.
This hold customers' details for their online account for a supermarket.
The fields are the following:
CustomerID bigint identy seed, Primary Key
Username nvarchar
Name nvarchar
Address nvarchar
City nvarchar
Postcode nvarchar
Password nvarchar
My question is. Do l need the customerID field as primary key. As username will be a unique value. No one will have the same username.
Like for e-mails, l have a username that is unique. Would I have another id as well. For e.g. Does yahoo have our usernames as our primary key fields?
I was thinking of desiging this database without the customerID, and only having username as the primary key.
Thanks in advance,
Steve
|
|
|
|
|
If the user name is unique and invariant make it the key...however if it can be changed or is not unique you shouldn't.
'--8<------------------------
Ex Datis:
Duncan Jones
Merrion Computing Ltd
|
|
|
|
|
steve_rm wrote: Like for e-mails, l have a username that is unique. Would I have another id as well. For e.g. Does yahoo have our usernames as our primary key fields?
Using a User name as primary key is probably a bad thing. Think about it how many Mike Smiths are there in the world? The answer is there are a lot of duplicate names in the world.
Do you think everyone of your customers are willing to give you their email address? What about the poeple in the world that don’t have email?
Seems to me your better off using the int as a primary key for the table.
Just my 2 cents...
ZeePain! wrote: This seems like one of those programs that started small, grew incrementally, building internal pressure, and finally barfed all over its source code sneakers. Or something.
thedailywtf.com[^]
|
|
|
|
|
hi, how can i save a real picture on the SQL DB and retrieve it.
Thanks alot
Hamody
|
|
|
|
|
Check out this[^]
Farhan Noor Qureshi
if (this == this) thow this;
|
|
|
|
|
Can anyone tell me why I am not seeing any SQL Server 2K user defined functions in the server explorer in VS.2003. The documentation talks about running a udf in server explorer by right clicking a udf in the udf folder - Well I ain't got no stinking udf folders in any SQL Server databases although I know they are there. Using professional edition.
Thanks
cduwel
|
|
|
|
|
This was posted in the VB forum as well since I was not sure which it pertained to.
Ok, not sure exactly how to word this so here goes. I have a winform in my project that has the following:
Controls
1. DropDownList1 - Customer Name
2. TextBox1 - Customer ID
3. DropDownList2 - Site Name
DataBase Tables
1. tblCust - Fields(CustName, CustID, Status)
2. tblCustSiteAssoc - Fields(CustId, CustSiteID)
3. tblCustSite - Fields(CustSiteID, CustSiteName, ...)
What I am trying to do is this:
1. When the form open have customers names bound to the DropDownList1 control with nothing selected
2. Once I select something in the DropDownList1 control (SelectedIndexChanged) have it update the other two controls with the selected customers' data.
I assume I make a DataSet that queries all three tables and I understand how to bind the CustName to the first DropDownList box. What I don't understand is how to use the selected information to get the relevant information for the other two controls.
Thanks in advance,
Taen Karth
Thanks,
Taen Karth
|
|
|
|
|
Can ADO be used in C (not Visual C++), using Microsoft Visual Studio? Is there any sample code on this? Thanks.
|
|
|
|
|
Since ADO is a COM server, I would doubt it.
Absolute faith corrupts as absolutely as absolute power
Eric Hoffer
All that is necessary for the triumph of evil is that good men do nothing.
Edmund Burke
|
|
|
|
|
Probably not directly, but there is nothing stopping you from creating a Windows DLL that wraps the ADO class heirarchy in a set of public functions. This DLL could then be used in straight C.
|
|
|
|
|
This DLL is not only be used by C, but also other client languages like Delphi, Borland C++, VB.NET etc. I am still figuring out how to wrap this ADO in the DLL so that it can be called by all client languages. Do you have any sample code or references that I may refer? Thanks.
|
|
|
|
|
Does this[^] help?
Farhan Noor Qureshi
if (this == this) thow this;
|
|
|
|
|
DateTime Updating Problem in sql?
below is the query that is a part of a sproc .All table
fields and values are ok. When the mentioned Sproc. is
called in query analyzer it executes well and update all
fields of the table used in UPDATE statement
.
UPDATE Emp_Schedule
SET IOS = 0, HoursWorked = @WorkTime, COA =getdate()
WHERE (Emp_Id = @EmpID) AND (S_Id = @ShiftId) AND (DT =@DayTime)
PROBLEM arises when i call this procedure from C# code all fields are updated Except the COA(DateTime) field.Whats the problem. SProc runs well both in debug mode and normal mode in query analyzer and do updates the values. But when i call in C# only datetime field COA is not Updated? Plz solve this.
THNX IN Advance.
|
|
|
|
|
Is it possible that this is a permissions problem? The user that executes the C# code, do they have execute permissions on the function?
Chris Meech
I am Canadian. [heard in a local bar]
Remember that in Texas, Gun Control is hitting what you aim at. [Richard Stringer]
Nice sig! [Tim Deveaux on Matt Newman's sig with a quote from me]
|
|
|
|
|
I want to brings all the published reports from the server and allow user to view them using SQL Server 2005 Report Builder. Can anyone provide me with a sample code or any website which may be of help.
|
|
|
|
|
Hey everybody,
I know this a pretty silly question but I totally blanked. I'm looking to remove duplicate results from the results set (NOT the table).
Say I have a query like so:
SELECT SomeNumber FROM MyTable ORDER BY SomeNumber ASC
returns the following set:
1
1
1
2
2
3
4
But I want it to return:
1
2
3
4
What extra criteria would I add to the query?
Thanks in advance for your help.
-------------------
abort, retry, fail?
|
|
|
|
|
SELECT distinct(SomeNumber) FROM MyTable ORDER BY SomeNumber ASC
|
|
|
|
|
thank you much, sir. just what i was looking for.
-------------------
abort, retry, fail?
|
|
|
|
|
Did that solution served your purpose ?
|
|
|
|
|
yes it did. thanks again!
-------------------
abort, retry, fail?
|
|
|
|
|
below is the function that compares only time .there are 3 datetime variables.
@StartTime datetime
@EndTime datetime
@DayTime datetime
@StartTime is always less than @EndTime regardless of its
dates.and @DayTime may be any time. We have to calculate
whether @DayTime lies between @StartTime and @EndTime or
not. And on its behalf we return a value.
if @DayTime lies between @StartTime and @EndTime return 1
else return 0.But tested with these values result is not ok.
set @StartTime='12/1/2005 12:30:49 PM'
set @EndTime='12/2/2005 4:30:49 AM'
set @DayTime='2005-12-02 00:56:02.730'
select dbo.udf_IsShiftValid(@StartTime,@EndTime,@DayTime )
it returns 0 where i think it should return 1. plz correct
me where m i wrong.
Actually i have to use this function on CheckInShfit event of the Employee. @StartTime and @EndTime are the time of the shifts that have already been defined in the database very ago. Now whenever Employee ChecksIn we have to confirm wheather he is entering Between his shift timing that have been Defined already in the database, if his CheckInTime (only time not date) @DayTime lies between his @StartTime and @EndTime then he is allowed to enter (i.e 1) else Not(0).
Now keeing in view the baove Scenario, plz guide me
plz modify this function so as it returns 1 if the @DayTime
Lies Between @StartTime And @EndTime else one( BUt keep in
Mind i m required to compare only time not the dates and
@startTime value is always less than @EndTime value)
CREATE FUNCTION dbo.udf_IsShiftValid(@StartTime datetime,
@EndTime datetime,@DayTime datetime)
RETURNS int AS
BEGIN
DECLARE @RtValue AS int
IF
convert(varchar,@DayTime,114)>=
convertvarchar,@StartTime,114) AND
convert(varchar,@DayTime,114)<
(convert(varchar,@EndTime,114)
BEGIN
SET @RtValue=1
END
ELSE
BEGIN
SET @RtValue=0
END
RETURN @RtValue
END
-- modified at 21:40 Thursday 1st December, 2005
|
|
|
|