|
I think this will help.
SELECT Col1, ColToSearch
FROM table
WHERE CONTAINS (ColToSearch, '"quick easy" or "Help"')
you must have full text index setup on the table field you are searching
|
|
|
|
|
Hi, Is there anyway to have SQL Server 2000 run a function on a database if a specific table is updated or a row added?
my problem is this I am having to work with two seperate databses for 2 sepreate programs, I need data from the first program in my second program,
but if anybody adds a new row or record to my table in database 1, I want to update the table in my second database using an sql server auto function, and the server must run a change on db2 if the table in db 1 is changed.
I hope this made sense, the main reason for doing this I do not have access to the source code for the first program so this must happen on the DB side.
|
|
|
|
|
i dont know exactly but i think it can be done with the help of Triggers
|
|
|
|
|
thanks man, I been searching the whole day for SQL watch, not trigger lol thanks man.
|
|
|
|
|
I have written a C# dll which makes a call to some unmanaged code.
When i tried to register this dll on SQL server 2005 i got the following error.
Msg 6215, Level 16, State 1, Line 1
CREATE ASSEMBLY failed because method 'AddNumbers' on type 'Project1._Class1' in safe assembly 'Interop.Project1' has invalid attribute 0x1003.
How do i register such a dll.
|
|
|
|
|
|
Good Morning All
i have the Following Cursor that Displays data , like this
<br />
SET NOCOUNT ON<br />
Declare @Property_ID int ,<br />
@Lis_key Varchar(12),<br />
@Effective_DAte Datetime,<br />
@Func_key Varchar(12),<br />
@Property_ID2 int ,<br />
@Lis_key2 Varchar(12),<br />
@Effective_DAte2 Datetime,<br />
@Func_key2 Varchar(12)<br />
<br />
Declare Find_Val Cursor for <br />
select p.Property_ID, p.Lis_key,v.Effective_Date,<br />
p.Func_key from Valuation v<br />
Inner Join Property p <br />
on p.Property_ID = v.Property_ID<br />
where V.Effective_date ='2002/07/01'<br />
And v.Val_Status_ID = 2<br />
And v.Archive_Date is NUll<br />
And p.Archive_Date is Null<br />
<br />
Open Cursor Find_Val<br />
<br />
FETCH NEXT FROM Find_Val INTO<br />
@Property_ID,<br />
@Lis_key,<br />
@Effective_DAte,<br />
@Func_key<br />
WHILE @@FETCH_STATUS = 0<br />
BEGIN<br />
SELECT @Property_ID,@Lis_key , @Effective_Date , @Func_key<br />
<br />
--Declare<br />
DECLARE Second_cursor CURSOR FOR <br />
select V.Property_ID, P.Lis_key,v.Effective_Date,<br />
p.Func_key from Valuation v, Property p<br />
where v.Property_ID = @Property_ID<br />
And EFFECTIVE_DATE = '2008/07/01'<br />
<br />
OPEN Second_cursor<br />
<br />
FETCH NEXT FROM Second_cursor INTO<br />
<br />
@Property_ID2,<br />
<br />
@Lis_key2,<br />
<br />
@Effective_DAte2,<br />
<br />
@Func_key2<br />
<br />
IF @@FETCH_STATUS <> 0 <br />
<br />
WHILE @@FETCH_STATUS = 0<br />
<br />
BEGIN<br />
<br />
SELECT @Property_ID2,<br />
<br />
@Lis_key2,<br />
<br />
@Effective_DAte2,<br />
<br />
@Func_key2<br />
<br />
<br />
FETCH NEXT FROM product_cursor INTO <br />
<br />
@Property_ID2,<br />
<br />
@Lis_key2,<br />
<br />
@Effective_DAte2,<br />
<br />
@Func_key2<br />
<br />
END<br />
<br />
CLOSE Second_cursor<br />
<br />
DEALLOCATE Second_cursor<br />
<br />
FETCH NEXT FROM Find_Val into<br />
@Property_ID,<br />
<br />
@Lis_key,<br />
<br />
@Effective_DAte,<br />
<br />
@Func_key<br />
<br />
End <br />
<br />
CLOSE Find_Val<br />
<br />
DEALLOCATE Find_Val<br />
And when i run this Cursor i get the Following Error
Msg 156, Level 15, State 1, Line 21
Incorrect syntax near the keyword 'Cursor'.
And this Points to this line
Open Cursor Find_Val
Thanks
Vuyiswa Maseko,
Sorrow is Better than Laughter, it may Sadden your Face, but It sharpens your Understanding
VB.NET/SQL7/2000/2005
http://vuyiswamb.007ihost.com
http://Ecadre.007ihost.com
vuyiswam@tshwane.gov.za
|
|
|
|
|
Vuyiswa wrote: And this Points to this line
Open Cursor Find_Val
The CURSOR keyword isn't required here, only OPEN <cursorname> .
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
Thanks man it worked
Thanks
Vuyiswa Maseko,
Sorrow is Better than Laughter, it may Sadden your Face, but It sharpens your Understanding
VB.NET/SQL7/2000/2005
http://vuyiswamb.007ihost.com
http://Ecadre.007ihost.com
vuyiswam@tshwane.gov.za
|
|
|
|
|
|
Try using DateDiff function
DATEDIFF(day, pubdate, getdate())
|
|
|
|
|
like this
select datediff(d,'2007-08-08',getdate())
2007-08-08 is old date getdate is new date
I love li li huang ,
ha ha ,
but you don't who is she!
|
|
|
|
|
Don't delete your question - It is rude!
|
|
|
|
|
Geeze, one of those
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
Hi,
I have an employee table with employee data like empid, empname, empcreateddate. Every data new employees will join, so data is inserted in this table. I want to need reports weekly, to know, In this weak how many new employees are joined?
How to do? can u give query for this?
I am not getting the result, when i am using this below query
Select * from Employees
where EmpCreatedDate between convert(varchar,getdate(),101) and convert(varchar,getdate()-7,101)
G. Satish
|
|
|
|
|
See date functions from msdn here[^]
DateAdd, DatePart and GetDate will be there to help you.
Regards,
Mehroz
|
|
|
|
|
Try the following query
Select * from Employees
where EmpCreatedDate between select DATEADD(DAY, -(DATEPART(dw,GETDATE())-1),GETDATE()) and getdate()
|
|
|
|
|
Select * from YourTable where datediff( day, YourColumn, Getdate()) < 8
Do good and have good.
|
|
|
|
|
Hi i have one doubt...,
I want to add a month from the given date...,
Mean suppose if i give a date(mm/dd/yyy)='01/01/2008' from that add 30 days and give '31/01/2008'
another example if i give '02/16/2008' add 30 days and give '03/16/2008'
like this,
how its possible?
Thanks & Regards,
NeW OnE,
please don't forget to vote on the post
|
|
|
|
|
You can use the DateAdd function. See msdn documentation
here[^]
Regard,
Mehroz
|
|
|
|
|
select dateadd(day,30,columnname) from tablename
Do good and have good.
|
|
|
|
|
thanks
Thanks & Regards,
NeW OnE,
please don't forget to vote on the post
|
|
|
|
|
Lets say that you get an ID from an external system.
Eg. PersonID
Lets also assume that you need to store local information related to that ID.
eg orders etc.
All those tables with related info would get an FK to PersonID
but there wouldnt be any "direct" data associated with the PersonID.
The result would be that we need a "person table" with only one field: PersonID wich is the PK in order to get true ref integrity between the id and the various related tables.
What does the DB normalization rules say about such cases?
Does it state anything at all?
It feels completely wrong in the sense that its stupid to have an ID that points to nothing.
But feels right in the sense that the child data can point to the root id and all the related tables would have valid FK's and cascades and all that crap would work as it should..
(yes this is very much a problem introduced by SOA)
Ideas?
Right or wrong? options?
|
|
|
|
|
Using SQL Server 2005...
I have a table (call it TableA) with a primary key column. I want to pull data from another table (call it TableB) and insert it into TableA using a stored procedure. There may be times when the record to be inserted into TableA will have a duplicate key value. I want the stored procedure to ignore duplicate key errors, and just move on to the next record to be inserted.
Is that possible? Does SQL already do it this way?
Alternatively, the stored procedure is creating tableB with new records that are to be added to tableA. What SQL statement will delete duplicates from table B before adding tableB's contents to tableA?
"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
|
|
|
|
|
The following query will delete records from tableB that have a key value which is already present in tableA.
delete
from tableB
where exists
(select top 1 * from tableA
where keyvalue = tableB.keyvalue)
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|