|
Hi all,
I wanna Format my database server due to some reason...
so how i can Backup of SQL Server Databases....
i have around 25 Databases in Sql Server.. and i wanna take backup of all..
So how i can perform this task..
plz guide Step by step....
i m new in DataBase Backup ......
Thanx
Sajjad
|
|
|
|
|
just simply copy all data & log files of all databases
then, restore all
<< >>
|
|
|
|
|
I want to enable TCP\IP protocol for sqlserver, for my client server application, at server side. Becoz i m using MSDE as database. I can enable it through by using SvrNetcn.exe, but want to enable it by vb.net code or by command line parameter or any other way with out using any User Interface. How i can do that?
SEC
|
|
|
|
|
Hi
I have a stored procedure (sp_getscores) that gets a parameter with type int( name it ID )
and returns one row with fields A int, B int, C int.
I need to use this stored procedure as :
I have a range of IDs say 100 to 150.
I want to use sp_getscore foreach ID in range of 100 to 150 and get the tabular result as
ID |A|B|C
___|_|_|____
100|.|.|.
101|.|.|.
...
150|.|.|
which . is an int.
It is obvious that i can achieve this by call the sp in .net application and use a for structure as
for( int i = 100 ; i<= 150 ;i++ )<br />
{<br />
}
But i need to have a sp that does this job for me.
Can anyone write me a t-sql to does this?
Thanks!
|
|
|
|
|
select table.A, table.B, table.C from table where ID in ( 100,101.....,150)
|
|
|
|
|
Please read my problem exactly
I never want what you say!!!
|
|
|
|
|
|
hi,
ı have a report on sql 2005 reporting services. and ı have a matrix on it. ı add a subtotal coloumn for this matrix, but ı want to add an extra coloumn.
for example, ı take some integer numbers totals in subtotal coloumn, and ı want to multiply this values with 50 and ı want to show it in an extra coloumn near subtotal coloumn. but ı didn't do it.
how can ı fix this problem?
please answer me on alisapanci@gmail.com
thanx
|
|
|
|
|
hi guys,
i really need your help
i want to import excel file to sql server table.
the problem is the recordset from excel connection, just insert first value of this recordset to sql server table, but record count is the same as recordcount from this recordset.
before the recordset inserted to sql server table, i display in MSFlexGrid, in MSFlexGrid the values is match with original excel file.
by the way, in excel connection and sql server connection i use aduseclient in cursorlocation, so the recordset support bookmark.
thank you
|
|
|
|
|
I don't understand your problem. Maybe in Indonesian, I'll understand it.
<italic>Work hard, Work effectively.
|
|
|
|
|
Hello,
I currently have a stored procedure that I call multiple times with an ID to return a record. However, in my program, I sometimes need to return several records (for which I have all the IDs) at the same time.
Is there a way I could pass an array of all IDs so I get all the necessary records with just one round-trip to the database?
[EDIT -- Something like this would be ideal:
CREATE PROCEDURE Whatever
(
@param int_array
)
AS
SELECT * FROM Table WHERE ID IN @param ]
Any help would be appreciated! Thanks!
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
The amount of sleep the average person needs is five more minutes. -- Vikram A Punathambekar, Aug. 11, 2005
-- modified at 13:08 Thursday 22nd September, 2005
|
|
|
|
|
Use the IN operator and pass the integer ids as a comma separated string.
Build the entire SQL statement in your application and execute the statement itself instead of calling a stored procedure.
SELECT * FROM Table WHERE ID IN (param1,param2,...)
Hope this helps...
Regards,
Orina DCosta
http://orina.org
|
|
|
|
|
Yes, I have thought of that. But the stored procedure is not just a single SELECT , so it is not as easy. Any other ideas?
Thanks anyway,
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
The amount of sleep the average person needs is five more minutes. -- Vikram A Punathambekar, Aug. 11, 2005
|
|
|
|
|
I prefer to use OpenXML rather than a comma delimited list. I'm not sure if that helps though - I suspect if you can't use one, you can't use the other ? OpenXML does translate nicely from XML to a table though, so it may be a better idea.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Hello Christian!
Are you talking about the OPENXML[^] T-SQL Function? If yes, I think that could help. I could build a little XML table with all the IDs and get all of the at once.
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
The amount of sleep the average person needs is five more minutes. -- Vikram A Punathambekar, Aug. 11, 2005
|
|
|
|
|
Yes, I am. That stuff totally rocks.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
hi,
I know this may look easy for some,but I need help with it. I have three tables "inhabitants","Payement" and "postponedPayement". I need to select from inhabitants those that didn't pay their loan and store their Ids along with the unpayed period into table "postponedPayement". The table "inhabitant" gathers all the inhabitants of a bulding while "Payement" table gathers all the payement made by an speific inhabitant for a specific month.
I wonder if someone know how I can do it automaticaly by the end of each month using SQL.
thanks in advance
It's not shame to ask if we don't know but it's shame to pretend you know when u don't
-- modified at 11:53 Thursday 22nd September, 2005
|
|
|
|
|
From your post I think your table structure looks something like this (I've tried to fill in the gaps with information that seems to fit the description - if this is not the case then a more accurate description would be more helpful)
Inhabitants
-----------
ID
Payment
-------
InhabitantsID (Foreign key join to Inhabitants.ID)
Date
PaymentAmount
PostponedPayment
----------------
InhabitantsID (Foreign key join to Inhabitants.ID)
UnpaidPeriod
Try this query
INSERT INTO PostponedPayment(InhabitantsID, UnpaidPeriod)
SELECT InhabitantsID, COUNT(*) AS UnpaidPeriod
WHERE p.PaymentAmount = 0
GROUP BY InhabitantsID
It will count all the periods unpaid for each inhabitant and insert it in the PostponedPayment table.
Does this help?
My: Blog | Photos
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucious
|
|
|
|
|
thank u Mr Mackay,
my tables look like this
inhabitant
----------
inhabitantId
... info about inhabitant
Appartment
----------
AppartementId
inhabitantId
Amount //the amount that the inhabitant shoul pay monthly
Payement
---------
inhabitantId
AmountPayed //the amount payed is what's paid each month if done
date //date the the paid amount
PostponedPayement
-----------------
InhabitantId
amountdue
Referencedate //the reference of the unpaid month
I need to get the inhabitants that didn't pay for each month and store these in my PostponedPayement table.
for example
Appartement Inhabitant Payement
--------------------| ----------------| ----------------------------
ApptId inhId Amount| InhID | InhaName| inhId |paidAmount|Date
--------------------| ------|---------| -------|----------|---------
177/R1 inh1 150 | inh1 | James | inh1 | 150 |01/08/2005
177/R2 inh2 180 | inh2 | Jone | inh4 | 100 |05/08/2005
177/R3 inh3 150 | inh3 | Greg |
177/R4 inh4 100 | inh4 | mike |
in my PostponedPayment table I need to get this for august payments plus what is left from other months
PostponedPayement
------------------------------
InhabitantId|AmountDue|Refdate|
------------|---------|-------|
inh2 | 180 |08/2005|
inh3 | 150 |08/2005|
inh1 | 150 |06/2005|
I did the following query to get all those who paid and those who didn't :
select Appartement.ApptId, date, Payement.Amount from Appartement left join Payement on Payement.ApptId=Appartement.ApptId
I get the following
---------------------------------
InhabitantId|Amount | date |
------------|---------|----------|
inh1 | 150 |01/08/2005|
inh4 | 150 |05/08/2005|
inh2 | Null | null |
inh3 | Null | null |
all I need to pik up are the 2 last values in the example and insert them into PostponedPayment
Hope it's clearer now!excuse my English
But I thank yu very much
Thanks to all those who help and those who try to help
|
|
|
|
|
I have a report that will come back as 20 pages.
What the user wants is on the beginning of another unique ID, which causes a new page to be started, to have the page count restart to 1.
So, if I have 3 UniqueIDs for all 20 pages, and the first, IDAA, is 10 pages long, the second, IDBB, is 4 pages long, and the third, IDCC, is 6 pages long, then the page numbering would be as:
1-10 for IDAA
1-4 for IDBB
1-6 for IDCC
I've been told to set a cursor in a SP that determines what page I'm on and then passses this to the result set as a column. This is then set in a group to control page breaks. How could I do this? I'm not very familiar with SPROC cursors.
I know how to do this scenario in Crystal Reports, but am trying to figure it out here with either a page count formula, or some type of distinct count().
Thanks!
|
|
|
|
|
This is what I've tried so far, but it resets on every page.
So, each page is 1 even if the Unique ID spans 2-3 pages.
I only need it to reset on a new field grouping of the list object.
Here's the VB code for the report:
Shared offset As Integer
Public Function GetPN(reset As Boolean, pagenumber As Integer) As Integer
If reset
offset = pagenumber - 1
End If
Return pagenumber - offset
End Function
***************************
In the header, I have a textbox named "tag"
In the footer, I've got the following expression:
="Unique ID Page: " & Code.GetPN(Not(ReportItems!tag.Value Is Nothing),Globals!PageNumber)
|
|
|
|
|
My fault...I had the textbox "tag" in the page header and not in the list object itself.
It works!
Thanks!
-- modified at 17:02 Thursday 22nd September, 2005
|
|
|
|
|
this query is perfect in Ms-Access but its not working in Sql Server
UPDATE EmpDept INNER JOIN clockings ON EmpDept.clockno=clockings.clockno SET clockings.deptid = empDept.deptid;
it shows following error msg.
Incorrect syntax near the keyword 'INNER'.
Naveed Kamboh
|
|
|
|
|
The basic syntax of UPDATE statement in SQL Server is
UPDATE {table_name | view_name}
SET column_name1 = {expression1 | NULL | DEFAULT | (SELECT)}
[, column_name2 = {expression2 | NULL | DEFAULT | (SELECT)}
[ ,...n ]
WHERE {search_conditions}
Try this.
UPDATE clockings SET clockings.deptid = ( SELECT EmpDept.deptid from EmpDept WHERE clockings.clockno = EmpDept.clockno )
|
|
|
|
|
I have used UPDATE s with JOIN s before, and it works in SQL Server. I believe the SET clause should come before the JOIN , and also, that you need a FROM clause before any JOIN .
Try this:
UPDATE clockings SET clockings.deptid = empDept.deptid
FROM EmpDept
WHERE EmpDept.clockno = clockings.clockno I hope this helps!
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
The amount of sleep the average person needs is five more minutes. -- Vikram A Punathambekar, Aug. 11, 2005
|
|
|
|