|
The "interval" is the time span during which dups were inserted in seconds. I though "interval" seemed appropriate.
I've since found out that the multiple records are not dups. So there is no longer a need to do the record comparison and mark them in any way. We just need the vendor to answer a phone call so we can understand their model and eventually write a valid statement to aggregate all the related repair records by repair. (For example, an operator sees that a repair is needed, hits the button, automated machine repair happens, repair not effective, hits the button" should be 1 repair event, not 2).
_i
|
|
|
|
|
any one remind me how to update,delete on asp.net based on given txtfield?
e.g we write code like this in oracle:
--update code:
update EMP set f_name=:txt_name
where id=:txt_id;
commit;
---delete code:
delete from EMP
where id=:txt_id;
commit;
yesser
yasser
|
|
|
|
|
Best way to do this is through parameterized queries. See this[^] article for advice.
Obviously, you will want to use the Oracle .Net providers.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
imports system.data.sqlclient
dim objsqlconn as sqlconnection
dim objsqlcmd as sqlcommand
dim dataset as dataset
dim strupdate as string
first update
objsqlconn=new sqlconnection("user id=sa;password=;initial catalog=databasename;data source=servername")
objsqlconn.open
strupdate="update EMP set f_name=:txt_name where id=:txt_id"
objsqlcmd=new sqlcommand(strupdate,objsqlconn)
objsqlcmd.executenonquery()
messagebox.show("Record successfully update")
second delete
objsqlconn=new sqlconnection("user id=sa;password=;initial catalog=databasename;data source=servername")
objsqlconn.open
strdelete="delete from EMP where id=:txt_id"
objsqlcmd=new sqlcommand(strdelete,objsqlconn)
objsqlcmd.executenonquery()
messagebox.show("Record successfully delete")
|
|
|
|
|
Thanks rohitsrivastava this is very Advance code ,but at the moment am using access database .I want only the Syntax or the command to delete,update.
I remmber in the past I was writing like this but am not soure about the Syntax
updatecode="update EMP set f_name Val&"(first_name.txt)"&''&"where id=Val&"(txtid.txt)"&"
-- modified at 8:07 Wednesday 12th September, 2007
yasser
|
|
|
|
|
How do you think this will work? First of all, you are connecting to SQL Server here, secondly the strupdate command is wrong. Finally, always use parameterized queries as they are much better.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Hi All,
How do i get week of a month?
somthing like ....
Datename(week,getdate())
Can you please help?
Thanks
kibrom
|
|
|
|
|
select datediff(week,'2007.09.01',getdate())
it return value 2 which means it is second week from given date
I Love SQL
|
|
|
|
|
|
Months don't have weeks, years have weeks. At least that seems to be what ISO says.
|
|
|
|
|
SELECT CAST(DATEPART(wk,getdate())-DATEPART(wk,DATEADD(dd, -(DATEPART(dd, GETDATE()) - 1), GETDATE()))+1 as varchar)
|
|
|
|
|
Hi,i want to know that how can i get schedule back up from server to local ??
for example :
i have a database ("testDB")in the server ( www.server.com) then i need get backup every day and transfer all new data to my PC in (localhost ).
thanks.
|
|
|
|
|
objsqlconn=new sqlconnection("user id=sa;password=;data source=servername")
objsqlconn.open
objsqlcmd=new sqlcommand
objsqlcmd.connection=objsqlconn
objsqlcmd.commandtext="master..xp_cmdshell 'del d:\" + databasename + "'"
objsqlcmd.commandtype=commandtype.text
objsqlcmd.executenonquery
objsqlcmd.commandtext=" backup database " + databasename + " to disk='" + databasename + "'"
objsqlcmd.commandtype=commandtype.text
objsqlcmd.executenonquery
this is coding to backup of database from the server
|
|
|
|
|
I have a string of hex characters "0x89504e". I convert this to a string of binary characters @sOutput = "100010010101000001001110". I then run SELECT CAST(@sOutput AS BINARY). This returns me "0x313030303130303130313031303030303031303031313130000000000000".
How would I go about converting the string to binary such that the value would return as the original "0x89504e"? It's looking like the CAST is treating the string as numeric and converting a really large int to binary.
|
|
|
|
|
SELECT CONVERT(varbinary(20), 'stringValue')
I Love SQL
|
|
|
|
|
sonal dadhania1 wrote: It's looking like the CAST is treating the string as numeric and converting a really large int to binary
It is treating the string as a string and converting it in to its ASCII codes.
I don't use binary data types much, but the following works:
DECLARE @hex AS VARBINARY(10)
SET @hex = 0x89504e
SELECT @hex
NOTE: There are no quotes/apostrophes around the hex value.
If you are coming from an application, use varbinary parameters and pass the value to the paramter as a byte array (byte[] )
|
|
|
|
|
Hi all,
I have a function called fnGetOrderItemPriceDummy, which takes two parameters, such as @OrderID & @chord. I was trying to execute this function in our linked server, and it fired error. My code follows.....
(Select * from Openquery([linkedserver],'select myserver.dbo.fnGetOrderItemPriceDummy ( '+ Convert(varchar(50) ,@OrderID)+' , '''''+ @chord+''''')) .
Can anyone say where is my mistake....
Thanks for your time.....
Sebastian
|
|
|
|
|
I don't know syntax of OPENQUERY command, but I am sure that you are missing a database name here:
select myserver.DATABASE.dbo.fnGetOrderItemPriceDummy
|
|
|
|
|
I have these tables
Customer Table:
CustomerID int; PK
FirstName nvarchar;
LastNaem nvarchar;
etc.;
Products Table:
ProductID int; PK
Name varcahr;
etc.;
OrderItems Table:
OrderItemID int; PK
ProductID int; FK
CustomerID int; FK
etc.;
Now I would like to get all users that have ordered: Product1 AND Product2, etc.
Only those people that orders all the selected products
-- modified at 21:15 Monday 10th September, 2007
|
|
|
|
|
Pass @Products --> with comma separated values like 'product1,product2'
and no of items @ProductCount --> 2
Select * from Customers Where CustomerID in
(Select CustomerID From
(Select CustomerID from OrderItems Inner Join Products on Products .ProductID = OrderItems.productid
Where [Name] IN (@products)
Group by CustomerID,[Name]) as Temp
Group by CustomerID having Count(CustomerID) = @productCount)
Best Regards,
Chetan Patel
|
|
|
|
|
This can't possibly work, can it?
I mean, the WHERE [Name] IN (@Products) part specifically.
|
|
|
|
|
If this has to work then the query should get execute using "EXEC sp_executesql " command
Regards J O H N
"Even eagles need a push." David McNally
|
|
|
|
|
You could create the inner query like this:
SELECT oi.CustomerID
FROM OrderItems oi
JOIN Products p
WHERE p.ProductID IN ('Product1', 'Product2')
GROUP BY oi.CustomerID
HAVING COUNT(*) = 2
You'll have to dynamically create the WHERE p.ProductID IN (...) part, and the value for the HAVING COUNT(*) = 2 should use a parameter.
Joined with the customer table, the results could look something like this:
DECLARE @NumberOfProducts int
SET @NumberOfProducts = 2
SELECT
c.*
FROM Customer c
JOIN
(
SELECT oi.CustomerID
FROM OrderItems oi
JOIN Products p
WHERE p.ProductID IN ('Product1', 'Product2')
GROUP BY oi.CustomerID
HAVING COUNT(*) = @NumberOfProducts
) AS t
ON t.CustomerID = c.CustomerID
|
|
|
|
|
|
Notify when a special partition in analysis service must update?
how i can triger a program to update a special partition of a cube at a required time?
or
how to found a way to know if a special partition need to be update?
thanks
|
|
|
|