|
Hello
A table with 50columns and 100 rows or A table with 10cols and more than 100 rows will consume more space ? I mean is it a good practice to have more number of columns ?
|
|
|
|
|
That is an implementation detail that would change from database to database.
For example in SQL Server all data is held in pages. Each page is 8060 bytes + some overhead for SQL Server's own use (total 8Kb). 8 pages make an extent. SQL Server reads the data off the disk in 64Kb blocks (one extent).
If you have a row that takes up 100 bytes, you can get 80 of them in a page, with 60 bytes left over. If a row takes any more that 4030 bytes you can only ever get one per page.
Also, how big is a column? An int is 4 bytes. A char(10) is ten bytes, a varchar(10) is upto ten bytes, and so on. If you have lots of varchars then the size of a row becomes flexible.
Navaneeth.I mean is it a good practice to have more number of columns ?
Ask yourself this. If you are in charge of a database that holds the details of every tax payer in your country. How many rows would there be? How many columns would you need? (Hint: There would be millions of rows)
|
|
|
|
|
Wonderful. I voted 5. Thanks for reply.
|
|
|
|
|
I have db filled with xml data, looks something like this:
Table Cars
{
Car, XML.
}
<car desc=”blue car with two doors”>
<owner>Sebastian Bach</owner>
</car>
I have made an full-text index of the xml-column and can now use the CONTAINS-keyword to search the xml-data.
Select car
FROM Cars
WHERE
CONTAINS(car, ‘Bach’);
But the problem is that if I search on a attribute value instead of a element value I get nothing.
Select car
FROM Cars
WHERE
CONTAINS(car, ‘blue’);
Can I solve this in some way?
|
|
|
|
|
I have Created a Procedure , i need to intergrate it with vb6, i know that one. i want to insert these fields into Property table and some of them i want to set them here in the Procedure, help to do that and assigning the value of textbox's in vb6 to the variable in a this Procedure. e.g num_key= txtnumkey. Here is my procedure but i did not finish it because of that part.
Create Procedure prcinserting @Num_key varchar(10),@Extension int,@Cell_ID int,
@Actual_Extent float,@Lis_key varchar(50), @Func_key varchar(8)
,@Active bit,@Add_date datetime,@Add_User_ID int,@Spatial_ADD_Date datetime
,@Rateable bit,Non_Discreet_Valid bit
with recompile
insert into Propery(Num_key,Extension,Cell_ID,Actual_Extent,Lis_key,Func_key,Active,Add_date,Add_User_ID,Spatial_ADD_Date,Rateable,Non_Discreet_Valid,)
values ()
-- modified at 8:54 Wednesday 16th May, 2007
-- modified at 8:55 Wednesday 16th May, 2007
Vuyiswa
|
|
|
|
|
I'll say it again, do NOT cross post in multiple forums.
|
|
|
|
|
Am Sorry itwont Happen again, i will stick to the VB forum for this Post
Vuyiswa
|
|
|
|
|
Hi everyone
Hope someone can help me cos I am becoming more and more stumped. Its a bit involved so please bear with me.
I have a datetime column in a table. This is set via a stored proc in vb.net to be of a type Data.SqlDbType.DateTime. Now this stores the Date passed in as mm-dd-yyyy. When I read it back vb.net does a grand job of turning it into the localised(UK) format, which is dd-mm-yyy for me with no extra processing on my behalf.
Problem comes in a view that I am using. This has two additional columns made up from this date using the commands.
, CAST(CONVERT(CHAR(10), dt_requested,103) as datetime) 'dt_requested_date'<br />
, CAST(CONVERT(CHAR(8), dt_requested,8) as datetime)-2 'dt_requested_time'
This is mostly so that I can perform so time analysis on the fields. However this does not work as I get a convert error with the casting of the datatype because even tho vb.net is expecting to read it in as mm-dd-yyyy and not in the way it is stored as dd-mm-yyyy. The other chaps that I work with say that in vb6 they used the TimeStamp sql Data type to store it as a binary but I am unable to get that to work with vb.net as it says it needs to be converted from a byte() which as the date is being read in as a string won't work...or I can't get it to work...one of the two.
Can anyone help me out? its driven me mad all morning! If you need any further info let me know. realise I prob haven't explained it too well lol
Thanks
Ian
|
|
|
|
|
Is the error at the code level or at database level?
Gautham
|
|
|
|
|
The error could be at both, sorry that doesn't help does it.
If i do the (CONVERT(CHAR(10), dt_requested,103) as datetime) using the value 103 as the type which is the british datetime(what I want)then I get a convert error at the database level of
The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value.
when running my select on the view. If i do it using the american standard which is 101...i think... then I get the error at the app level because my app is using expecting dates to be in the british format. That make sense? The problem comes with the way the DateTime is initially automatically stored in the database as this is stored in the british format as per my localisation settings.
I don't want to have to string format my dates whenever i use them so any help would be appreciated.
Cheers
Ian
|
|
|
|
|
Can anyone Please tell me what is the command to drop a particular column from a table OR alter a table.
Does it require that the table has no data while dropping a column ?
|
|
|
|
|
Try this:
ArchaBhandare wrote: Can anyone Please tell me what is the command to drop a particular column from a table.
ALTER TABLE tableName DROP COLUMN columnName.
ArchaBhandare wrote: Does it require that the table has no data while dropping a column ?
No, it can have data...
Regards,
Arun Kumar.A
|
|
|
|
|
Syntax to DROP a column:
ALTER TABLE table_name DROP COLUMN column_name
No,U can DROP the Column even if it contains data also.
Cheers
Chandu
|
|
|
|
|
Hi
I like to know the query for
Inserting values of COUNT(*) and SUM(column1) of TABLE_1 into TABLE_2
Please help me in this regard
Thank U
Chandu
|
|
|
|
|
Try this:
Begin
Declare @COUNT INT
Declare @SUM FLOAT
SELECT @COUNT=COUNT(*) FROM Table_1
SELECT @SUM=SUM(Column1) FROM Table_1
INSERT INTO TABLE_2 VALUES(@COUNT,@SUM)
END
Regards,
Arun Kumar.A
|
|
|
|
|
Its working
Thank u very much.
Cheers
Chandu
|
|
|
|
|
Insert into TABLE_2
Select Count(*), Sum(column1)
From TABLE_1
Wout Louwers
|
|
|
|
|
hi,
do you have an idee how can create a table with extern key?
please help
|
|
|
|
|
Hello i have to automate the process of instrument calibration system used at cement industry. Can any body help me in database design. i need acctually instruments specifications and their categories data .etc
waiting for reply
i m mustafvi from Pakistan
|
|
|
|
|
Hi
I am trying to populate Datagrid with result of stored procedure,but I am unable to do so.
I have to get the TOTAL COUNT of rows into the data grid.
My stored procedure is like this.....
usp_itemTotal --> Stored Procedure Name
CREATE PROC usp_itemTotal(@billNo INT)
BEGIN
AS
SELECT COUNT(*) FROM SuperMarketBill WHERE billNo = @billNo
I have to give the "billNo" at the time of executing the procedure.
and my C# code is som thing like this.....
cmd = new SqlCommand();
cmd.Connection = conn;
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = "usp_itemTotal";
param = new SqlParameter("@billNo", SqlDbType.Int);
param.Value=101;
cmd.Parameters.Add(param);
da = new SqlDataAdapter(cmd);
da.Fill(ds);
dgCall.DataSource = ds;
dgCall.DataBind();
Please asssit me in this regard.
Thank u
Chandu
|
|
|
|
|
If you are just required to show the count then why do you require datagrid, you could simply assign to a control like label etc..
Check your datagrid too!What is the error?
Gautham
|
|
|
|
|
Thannk u.
Above this Data Grid I am diaplaying another Data Gird to Display all the records of the table and it is working fine.
To Match with that data grid I am using another Data Grid to display count.
I am just getting a blank Data Grid with no items.
Otherwise tell me how to insert a string value into a datagrid without binding the datagrid.
Thank U
Chandu
|
|
|
|
|
you have to write the code in the item databound event of the first datagrid, did you do that?
Gautham
|
|
|
|
|
No,I just call wrote all the functionality in Page Load event handler and it should be their for my logic.
-- modified at 3:48 Wednesday 16th May, 2007
Thank U
Chandu
|
|
|
|
|
Chandu,
The second datagrid where you want the count is in a datagrid so the logic for filling the second datagrid should be written in the itemdatabound event of the first datagrid.
If you do this way it would be fine!
Gautham
|
|
|
|