|
Thanks for the reply.
But it will add the new column at the last.
But i want it to get added at the middle.
Is there any way to achieve this.
Selva
|
|
|
|
|
Column ordering is not important within a SQL server database - why do you need to do this.
|
|
|
|
|
SelvaKr wrote: But i want it to get added at the middle.
Is there any way to achieve this.
If it was me I would start by questioning the requirement, because it suggests that someone either doesn't know how databases work and/or are using it incorrectly for some other purpose.
But excluding that you would have to
1. Create temporary table.
2. Copy all of the data to the temp table.
3. Delete the original table.
4. Re-create with the new column
5. Copy all of the data back to the newly created table.
6. Delete the temp table.
Obviously you will need to deal with foreign keys appropriately. And it is likely that that the database can not be active (not processing work) while this is going on.
|
|
|
|
|
Hi
was wondering if anybody could help me. I was maid stored procedure as following:
USE [Spacva]
GO
/****** Object: StoredProcedure [dbo].[Test] Script Date: 11/13/2007 11:12:51 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[Test]
(
@START_DATE smalldatetime,
@END_DATE smalldatetime
)
AS
BEGIN
SELECT VOZILA.ID_VOZILA, VOZILA.PROIZVODNI_POGON, VOZILA.NAZIV, VOZILA.TIP, VOZILA.REG,
SUM(TOCENJE.KOL_L) AS Quantity, SUM(TOCENJE.SATI_RADA) AS Hours, SUM(TOCENJE.PROSJEK_L_PO_H) AS Average
FROM VOZILA INNER JOIN
TOCENJE ON VOZILA.ID_VOZILA = TOCENJE.ID_VOZILA
WHERE (TOCENJE.DATUM_UNOSA BETWEEN CONVERT(SMALLDATETIME, @START_DATE, 104) AND CONVERT(SMALLDATETIME, @END_DATE, 104))
GROUP BY VOZILA.ID_VOZILA, VOZILA.PROIZVODNI_POGON, VOZILA.NAZIV, VOZILA.TIP, VOZILA.REG
END
That stored procedure I was include in my Windows C# Project, just drag and drop to Win Form. My question is, how to add footer in established DataGrid, I mean how to add SUM of all selected values from column Quantity to my DataGrid?
I'm new in SQL, Visual .NET, C# so thanks in advance for help!
Zvonimir
|
|
|
|
|
You either have two options. Either manually iterate through the items in the datagrid after it is populated, do the sum and add a row. Or you can do some 'ROLLUP' functionality in the SQL query so when you pull it down into the datagrid, it already has the sum values you want in their own row(s).
|
|
|
|
|
Can some one tell me what's the difference between nvarchar and varchar. Similary for nchar and char
Regards,
LEE
|
|
|
|
|
|
http://geekswithblogs.net/claeyskurt/archive/2006/02/04/68161.aspx
|
|
|
|
|
hi
line by line debugging of a Stored Procedure is possible in Sql Server 2000.?
Regards,
Joe
|
|
|
|
|
|
thnx for the reply
i will check it out...
Regards
Joe
|
|
|
|
|
I have a problem with one of my sql query
Start Date is 10/11/2007 (dd/mm/yyy format)
End Date :10/12/2007
I have to get all dates listed from 11/11/2007 to 9/12/2007 (all dates between Start Date & End Date
Pls help me...
Sunil Nair
|
|
|
|
|
select * from table1 where mydate between @startdate and @enddate . Take a look at UTC and datetime formats to make sure that you are working with your date properly (you are using a stored procedure aren't you - and you are passing @startdate and @enddate in as datetime).
-- modified at 4:36 Tuesday 13th November, 2007
Ah - I see from others that you are trying to solve a different problem. Oh well.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Pete,
Unless and untill we get to know what solution was exactly required, we are not very sure of the problem.
Regards,
Adeel
Do rate the reply, if it helps or even if it doesnot, because it helps the members to know, what solved the issue. Thanks.
|
|
|
|
|
|
hi
while @fromdate<=@todate
begin
print dateadd(day,1,@fromdate)
set @fromdate=dateadd(day,1,@fromdate)
end
try this
Regards
Joe
|
|
|
|
|
Hello there guys.
Im using MS Access to store colleague's ID numbers and now I need to only the third to till the sixth digits of the ID number to determine if the person's birthday is today.(i.e 840920 5992 081 and I only take 0920 to and check if they are equal to today)
Does anyone knw how to do that.Ive tried to trim it and take only those digits but nothing works.
Thanx in advance.
kagiso
|
|
|
|
|
Hi,
Currently what datatype you are using for storing date of birth?
Regards,
Adeel
Do rate the reply, if it helps or even if it doesnot, because it helps the members to know, what solved the issue. Thanks.
|
|
|
|
|
Hi Adeel.
My Birthdate is a string. Same as the IDNumber.
Thanx in advance.
kagiso
|
|
|
|
|
|
Thank you very much.It helped a lot
kagiso
|
|
|
|
|
Hello,
If I want a table with decimal then what is te syntax I should use to create the table.
I have doubt about the data type to be used "decimal(10,2)"
Is the following right?
Create Table Sales (Amt decimal(10,2))
Thanks
Prithaa
|
|
|
|
|
Have you tried it?
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
Hello,
Yes I have tried it and it gives me field definition error.
I think the problem lies in declaring right kind of data type . decimal(10,2) or numeric(10,2) doesn't work.
Pritha
|
|
|
|
|
The syntax you gave in your original post works for me. There must be another error in your code. Have you posted all your code?
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|