|
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
|
|
|
|
|
i try the following code:
public void RunOleDbTransaction(string myConnString)
{
OleDbConnection myConnection = new OleDbConnection(myConnString);
myConnection.Open();
OleDbCommand myCommand = myConnection.CreateCommand();
OleDbTransaction myTrans;
// Start a local transaction
myTrans = myConnection.BeginTransaction(IsolationLevel.ReadCommitted);
// Assign transaction object for a pending local transaction
myCommand.Connection = myConnection;
myCommand.Transaction = myTrans;
try
{
myCommand.CommandText = "Insert into Region (RegionID, RegionDescription) VALUES (100, 'Description')";
myCommand.ExecuteNonQuery();
myCommand.CommandText = "Insert into Region (RegionID, RegionDescription) VALUES (101, 'Description')";
myCommand.ExecuteNonQuery();
myTrans.Commit();
Console.WriteLine("Both records are written to database.");
}
catch(Exception e)
{
try
{
myTrans.Rollback();
}
catch (OleDbException ex)
{
if (myTrans.Connection != null)
{
Console.WriteLine("An exception of type " + ex.GetType() +
" was encountered while attempting to roll back the transaction.");
}
}
Console.WriteLine("An exception of type " + e.GetType() +
" was encountered while inserting the data.");
Console.WriteLine("Neither record was written to database.");
}
finally
{
myConnection.Close();
}
}
but i get the following exception : An unhandled exception of type 'System.InvalidOperationException' occurred in system.data.dll
Additional information: This OleDbTransaction has completed; it is no longer usable.
this exception occure when : myTrans.Rollback();
Please help me avoid this exception.
Please advice.
|
|
|
|
|
Hi
Your code is working fine.
I commented all the catch Procedure and I executed your code.
It just giving the output and I also checked the table.Records are inserted.
Once check your catch block and execute it.
Cheers
Chandu
|
|
|
|