|
UPDATE MyTable<br />
SET TheDateColumn = NULL<br />
WHERE TheDateColumn = '1900-01-01'
|
|
|
|
|
Hi all,
I am developing a calendar application in C# that will require to store certain data (like date events, calendar style and some other preferences)in a database.
My preference will be MS SQL 2005 (though could be MySQL, or similar), however I wish to know if I was to use MS SQL 2005, could I include some dlls or other resource in the install of the application, purely for the application to run, without having to install another copy of MS SQL 2005 in the client PC? Like a cut down version of MS SQL 2005 as client site install? Otherwise I may have to go for MySQL or MS Access 2003, to avoid extra cost of the application.
Any ideas an suggestions are welcome.
Thanks in advance.
Alain
|
|
|
|
|
i need to make a copy of a datatable's row (access database).
since the table has quite a lot of columns i don't want to do it column by column:
INSERT INTO myTable(Col1, Col2, Col3) SELECT Col1, Col2, Col3 FROM myTable WHERE ID = 2
but by inserting the whole row like this:
INSERT INTO myTable SELECT * FROM myTable WHERE ID = 2
i think i found an example like that somewhere on the net. but it doesn't work for me. any solution?
"I love deadlines. I like the whooshing sound they make as they fly by." (DNA)
|
|
|
|
|
Smithers-Jones wrote: think i found an example like that somewhere on the net. but it doesn't work for me
Why doesn't it work? What error do you get?
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
it says
"an unattended exception of the type 'system.data.oledb.oledbexception' occured in system.data.dll"
(hope i translated it correct to english).
i created a module to do all my database-connections, in this module i have among others a sub to which i pass sql-commands as string and that then executes the sql-command.
the error occurs when executing the oledbcommand (myOleDbCommand.ExecuteNonQuerry).
i experienced this error usually only, when there is some error in the sql-command.
that's why i think the sql-command is incorrect or not working with access.
"I love deadlines. I like the whooshing sound they make as they fly by." (DNA)
|
|
|
|
|
Just out of curiosity, how many records can a query return to a calling .net app before weird stuff starts happening? I'm writing code that could potentially return millions of records in a single query.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
John Simmons / outlaw programmer wrote: I'm writing code that could potentially return millions of records in a single query.
What are you going to do with these records? If you are presenting them to the user, you should consider using some sort of paging mechanism to limit the number of rows returned from the database.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
I'm trying to order a table by a datetime column (ASC) , then delete the top 3 rows. Help out the n00b. Here's what doesn't work..
DELETE TOP(3)
FROM Table
ORDER BY DateTime ASC
DELETE TOP(3)
FROM Table
WHERE (SELECT * FROM Table ORDER BY DateTime ASC)
i've tried hundreds of other combinations.. Thanks guys/gals.
modified on Wednesday, February 13, 2008 1:58 PM
|
|
|
|
|
Nevermind, figured it out... Thanks all!
DELETE FROM TableName
WHERE (DateTimeCol IN
(SELECT TOP (3) DateTimeCol
FROM TableName AS TableName_1
ORDER BY DateTimeCol))
|
|
|
|
|
I am very much a newbie in terms of database design and am in need of some guidance.
I have to store come contact information in one of my database tables and was wondering what would be the best approach to take. Should I split up the address with separate fields for city, state, zip etc, or store it all in one varchar block ?
What would be the better approach to take with respect to maintainability and performance?
Thank you for your time
|
|
|
|
|
phesx wrote: Should I split up the address with separate fields for city, state, zip etc
Yes, that would be a better option. When you need the address as a whole it is easy to get them concatenated. Having the entire address under one varchar column is complicated when you need them individually.
Give a man a fish, he'll eat for a day. Teach a man how to fish, he'll eat for lifetime.
Pradeep Joe
|
|
|
|
|
Hey everybody!
I'm a bit new in unmanaged c++, let alone ADO, so its a bit of a newbie question...
I'm trying to get the signatures of the stored procedures in my database.
Thanks!
|
|
|
|
|
Hi,
This is my stored prosecure.But when i execute
exec CreateDataBases 'testdb','testdb','c:\\testdb.mdf','c:\\testdb.ldf'
It says the db already exists??
Am confused plaease help me...
-- ================================================
-- Template generated from Template Explorer using:
-- Create Procedure (New Menu).SQL
--
-- Use the Specify Values for Template Parameters
-- command (Ctrl-Shift-M) to fill in the parameter
-- values below.
--
-- This block of comments will not be included in
-- the definition of the procedure.
-- ================================================
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: <author,,name>
-- Create date: <create date,,="">
-- Description: <description,,>
-- =============================================
Create PROCEDURE CreateDataBases
-- Add the parameters for the stored procedure here
(
@database nvarchar(100),
@databaseName nvarchar(100),
@mdfName nvarchar(100),
@ldfName nvarchar(100)
)
AS
declare @qry nvarchar(800)
BEGIN
select @qry = 'CREATE DATABASE ' + @database +
' ON PRIMARY (NAME= ' + @databaseName +',
FILENAME ='''+ @mdfName + ''',
SIZE = 2MB, MAXSIZE = 10MB, FILEGROWTH = 10%)
LOG ON (NAME ='+@databaseName+',FILENAME='''+ @ldfName+''',SIZE = 1MB,
MAXSIZE = 5MB, FILEGROWTH = 10%)'
--print @qry
exec SP_Executesql @qry
END
GO
exec CreateDataBases 'testdb','testdb','c:\\testdb.mdf','c:\\testdb.ldf'
|
|
|
|
|
It probably means that there is already a "testdb" database on your server.
|
|
|
|
|
That's a pretty wild guess based on such an unclear error message...
|
|
|
|
|
Yes,because there is no other by that name.Thats why i am so much lost.
For example i am creating the same stored procedure in another comp.But still getting the same error.
|
|
|
|
|
A database creation script is supposed to look like:
CREATE DATABASE [testdb]
ON (NAME = N'testdb_Data', FILENAME = N'C:\testdb_Data.mdf',
SIZE = 2MB, MAXSIZE = 10MB, FILEGROWTH = 10%)
LOG ON (NAME = N'testdb_Log', FILENAME = N'C:\testdb_Log.ldf',
SIZE = 5MB, MAXSIZE = 5MB, FILEGROWTH = 10%) If uncomment your "print" statement you will find that you are giving the log the same name as the database.
Regards
Andy
|
|
|
|
|
Thanks Andy,I will check it out and keep you posted
|
|
|
|
|
Hi,
I am having the following problem AFTER converting to VS2008 from VS2005 and SQLCE 3.5 from 3.01:
SQL CE db file has a table called Court0 with various columns of type float. I populate the values by copying floats from another table/tables. I do this via ado.net using this code snippet:
foreach (DataColumn column in this.mycourtsDataSet1.Tables[tableName].Columns)
{
string columnName = column.ColumnName.ToString();
string columnValue = aRow[0][columnName].ToString();
object cValue = aRow[0][columnName];
if (columnName.Remove(1) == "T" && !string.IsNullOrEmpty(columnValue))
{
// Add the value to the Court0 table.
DataRow[] bRow = this.mycourtsDataSet1.Tables["Court0"].Select("BookingPeriod = '" + columnName + "'");
if (bRow.Length > 0)
{
double colValue = Convert.ToDouble(cValue);
//bRow[0][tableName] = Convert.ToInt32(columnValue);
========> bRow[0][tableName] = colValue; <==== colValue is '1055.01'
}
}
}
}
This works fine in VS2005/CE3.01 BUT not in VS2008/CE3.5
In CE3.5, the value entered into the cell looses it's decimal value.
For example, '1055.01' becomes '1055.0' in CE3.5 .
Can someone explain to me why the conversion stuffs up in CE3.5 and what do I do to fix it.
Thanks,
Glen Harvy
|
|
|
|
|
If you need a decimal quantity to retain its decimal representation through storage and manipulation in a program, you should be using decimal data types.
Binary floating point types are generally more effective for scientific computation, but they cannot preserve what appear to be simple decimal values. To two decimal places, only the fractions 0.00, 0.25, 0.50 and 0.75 are recorded accurately; the other 96 values are approximations.
Binary floating point records fractional values as sums of negative powers of two, that is, 1/2 + 1/4 + 1/8 + 1/16 + 1/32 + ... 0.01's closest approximation is 1/16 + 1/32 + 1/256 + 1/512 + 1/4096 + 1/8192 + 1/65536, to 16 fractional bits. This is 0.0999908447265625.
Conversions between different floating point representations can cause significant digits to be lost.
DoEvents: Generating unexpected recursion since 1991
|
|
|
|
|
Thanks for your response - much appreciated as I'm pulling my hair out down here!!
I have changed the SSCE 3.5 to type Money (there is no 'decimal' in SSCE) as well as the dataTable to type decimal. (I have also tried other numeric types as well in my trials and tribulations).
Providing I don't execute the following, I don't lose the decimal portion:
this.court0TableAdapter1.Update(this.mycourtsDataSet1.Court0);
this.mycourtsDataSet1.AcceptChanges();
this.court0TableAdapter1.Fill(this.mycourtsDataSet1.Court0);
I'm almost at the stage of using strings to store my data and a hell of a lot of conversions but that seems ludicrous
Somethings changed between VS2005/2008 and CE3.01/CE3.5
Later ...
The problem was with VS2008 not updating the SQLce data engine during conversion. Once I "reconfigured" the dataadapter all was fixed.
Glen Harvy
|
|
|
|
|
What are advantages of using common table expression(using with statement) in SQL.
Do good and have good.
|
|
|
|
|
Will this[^] or this[^]address your concern?
Give a man a fish, he'll eat for a day. Teach a man how to fish, he'll eat for lifetime.
Pradeep Joe
|
|
|
|
|
CREATE PROCEDURE GetThreadMessages
@iThreadID int
AS
SELECT message_id,
thread_id,
user_id,
first_names,
last_name,
email,
subject,
body,
date_submitted,
category_name,
category_id,
last_edited
FROM message_view
WHERE thread_id = @iThreadID
ORDER BY date_submitted asc
PLS HELP
DELETE ?
UPDATE ?
Boya - Badana - Tadilat ve Tamirat Isleri Bir Yudum Kahve Molasi (Coffee) Dügün Nisan ve Gelinlik (wedding)
Google Reklamlarinizi Sadece Siz Yönetin Elektrik Proje Tesisat Projesi Çizimi Illere Göre Nakliyat Firmalari Istatistik
http://www.evdenevenakliyatbul.com
|
|
|
|
|
love_man001 wrote: PLS HELP
DELETE ?
UPDATE ?
What does that mean?
|
|
|
|