|
I am not sure if I've got your concern at the right end, my apologies if I am wrong.
Probably you can introduce a new column in the dB indicating that the specified range of date(s) is/are already blocked for an event.
|
|
|
|
|
Its not really what I am looking for, but I am willing to try. Unfortunately, I don't know how to implement this. Thanks
|
|
|
|
|
Range comparisons are not that horrible if you break them down. In order for a range to overlap, the first requirement would be that the New.StartDate is less than (or equal too) the Stored.EndDate . If not, then they don't clash. If it is true, then see if the New.EndDate is greater than (or equal too) the Stored.StartDate . If this is also true, then you have an overlapping range.
In a stored proceedure it would look something like this:
IF EXISTS(SELECT *
FROM [MyTable]
WHERE
@StartDate <= [EndDate] AND
@EndDate >= [StartDate])
BEGIN
END
ELSE
BEGIN
END
|
|
|
|
|
Hey,
I m trying to fetch field names from a table in an access database.
can anybody tell me how to do it
is there any table that contain all the field names or any other way to get
i m using VC++ 6.0
thank you
Regards,
Pankaj Sachdeva
"There is no future lies in any job"
"but"
"future lies in the person who holds the job"
|
|
|
|
|
What I do, with all the types of database I've yet encountered, is to use the DataReader's GetSchemaTable method.
(I use C#)
Open the connection -- con.Open() ;
Set the command -- cmd.CommandText = "SELECT * FROM table" ;
Use ExecuteReader -- reader = cmd.ExecuteReader() ;
Call GetSchemaTable -- table = reader.GetSchemaTable() ;
Cancel the Command -- cmd.Cancel ; (Not all databases support this.)
Close the DataReader -- reader.Close() ;
Close the connection -- con.Close() ;
|
|
|
|
|
--------------------------------------------------------------------------------
Hi,
We are creating a small apllication ,and we want to deploy all the reports in the single server ,how to configure this server,
so that others can acces the reports in this server and also deploy their reports
|
|
|
|
|
Dear everyone.
hope you all will be fine and good in health.
i have a problem that i want to fetch a listbox with names. please help me that what code i have to write.
PICTURE IS HERE;
i have a table STUDENT with attributes (ID, Name, Age)
i have inserted 100 students record into STUDENT tabl
i have a listbox control named lstStdents on my form
now i want that when my form is opened, it should auotmatically fill the listbox with NAME of students
i want to know that how to fill that box using datareader?
thanks
|
|
|
|
|
While (dr.Read)
lstStdents .Items.Add(dr.Item("Name"))
End While
Panchal Hardik
|
|
|
|
|
Dear everyone.
hope you all will be fine and good in health.
i have a problem that i want to fetch a listbox with names. please help me that what code i have to write.
PICTURE IS HERE;
i have a table STUDENT with attributes (ID, Name, Age)
i have inserted 100 students record into STUDENT tabl
i have a listbox control named lstStdents on my form
now i want that when my form is opened, it should auotmatically fill the listbox with NAME of students
i want to know that how to fill that box using datareader?
thanks
|
|
|
|
|
like in ms-access , we link the two tables by connecting their id's , in the relationship form, there i select the tables and connect them by creating the primary and foreign relationships betweeb the id's.
Now my question is , is there any way to link the id's so that when i open the table , i can see the + sign , and after clicking the + sign , i get the information - correspondig to that id in sql server 2000
Sonia Gupta
Soniagupta1@yahoo.co.in
Yahoo messengerId-soniagupta1
Love is Friendship and Friendship is Love....
|
|
|
|
|
No you can't. You have to query against the table with the id to get the information.
Regards John
|
|
|
|
|
|
This is not possible becasue tables in SQL Server are not physically linked.
Regards
KP
|
|
|
|
|
is this facility available in sql server 2005
Sonia Gupta
Soniagupta1@yahoo.co.in
Yahoo messengerId-soniagupta1
Love is Friendship and Friendship is Love....
|
|
|
|
|
in aspnetdb.mdf there are restrictions on the password i want it to be null or without the non alpha-numeric caracter help plz
BiG RaLpH
|
|
|
|
|
Hi there,
Hope someone can help me,
I'm trying to resolve orphaned users in SQL server.
I created a procedure that works very nice in SQL server 2005, but it's having problems in SQL server 2000.
Here is the problem part of my code:
create table #Users(
username varchar(20),
userId varchar(250))
insert into #Users
exec sp_change_users_login 'Report'
select * from #Users
Then I get this error:
Server: Msg 15289, Level 16, State 1, Procedure sp_change_users_login, Line 27
Terminating this procedure. Cannot have an open transaction when this is run.
Hope you can help.
Thank you
|
|
|
|
|
Hi again,
Ok, I'm going to post my own fix on this :P
But would still like ideas on the original problem, if someone has.
I basically just did what the SP did in a short query:
select name AS UserName, sid AS UserSID
from sysusers
where issqluser = 1
and (sid is not null and sid <> 0x0)
and suser_sname(sid) is null
order by name
Kind regards
|
|
|
|
|
Hello all,
I have a products table (see below)
Product State
Apple |1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|2 0|21|22|23|24|25|26|27|
I have to display the state data on a webform replacing the numbers with actual state names for example replace 1 with auckland, 2 with northland and so on. How to do this in SQL.
the returned data from my sql query should look like this string, how do i write the query to acheive this.
Auckland Northland Waikatoo
Please help.
Cheers, Shilpa.
Thanks in Advance for your help. Best Regards
|
|
|
|
|
tblProductsS (table)
(columns)
Product_ID int
Product_Name Nvarchar
State Nvarchar
tblState (table)
(Columns)
State_Id int
State_Name Nvarchar
sql
----
DECLARE @SQLQuery AS NVARCHAR(2000)
DECLARE @SubQuery AS NVARCHAR(100)
select @SubQuery=Replace(State,'|',',') from tblProductsS where Product_ID = 1 --@ProductID
SET @SQLQuery = 'Select State_Name from tblstate where State_ID IN ('
SET @SQLQuery = @SQLQuery + @SubQuery
SET @SQLQuery = @SQLQuery + ')'
EXEC sp_executesql @SQLQuery
Regards John
|
|
|
|
|
We can do this, if you can give us more information about other tables like
a)Where is the state information stored? Is it in a separate table and how "product" table and this table are related?
b)What input you pass to the query EX: you just wanted to pass the number Ex: 1 or 2 etc right?
I can provide you currently the abstract code it will look some thing like this.
Suppose the input request from webform to db is '15'
Declare @check_cond int
Select @check_cond = PATINDEX('%15%',product state)
from products
Now, @check_cond contains the position of your input in the product state column of products table. patindex returns zero if it does not match your input.
Thanks!
Santhosh Kumar Edukulla
|
|
|
|
|
PATINDEX function returns the starting position of the pattern within the string being searched.
I don't think this is neccessary...
Regards John
|
|
|
|
|
Patindex is used to check whether the given 'id' is in products table.
Then Use the same input id to query the productstate table to know the statename accordingly.
Thanks!
Santhosh Kumar Edukulla
|
|
|
|
|
I have a requirement to mark duplicate records when I pull them from the database.
However, I only want to mark the 2nd, 3rd, 4th etc record - not the first one.
The code I have below creates a column called Dupes but marks all the duplicates - including the first one.
Is there a way to only mark the 2nd, 3rd, 4th etc record ?
SELECT *, cs.CallStatusDescription as CSRStatusDesc, cs2.CallStatusDescription as CustomerStatusDesc, (Select MAX(CallAttemptNumber)From CallResults cr Where cl.Id = cr.CallLogId) as CallAttemptNumber,
Dupes = (select count(id)
from CallLogs
where (CustomerHomePhone != '' AND cl.CustomerHomePhone = CustomerHomePhone)
OR (CustomerBusinessPhone != '' AND cl.CustomerBusinessPhone = CustomerBusinessPhone)
AND DealerId= 'hdsh'
AND CSRStatus IS NULL
and datediff(d, logdate, getdate()) <= 21),
FROM CallLogs cl
left Join CallStatus cs on cs.Id = cl.CSRstatus
left Join CallStatus cs2 on cs2.Id = cl.Customerstatus
Where SaleStage IN ('1', '2', '3', '4', '5', '6') And (LogProcessFlag = 1 Or LogProcessFlag = 0)
And DealerId='hdsh'
And Logdate Between '08/01/2007' And '08/31/2007'
|
|
|
|
|
id<=c1.id
add one more condition (id<=c1.id) to the subquery which Dupes column will generate a sequence num for the subsequent duplicate records. All Dupes with value (1) should be considered as first occurance and rest Dupes value with 2, 3, 4... are 2,3,4... occurances
Not sure. just check
Regards John
|
|
|
|
|
I have a reporting Database, which contains monthly metrics, now i want to develop a page in Sharepoint portal, which pulls all records from this reporting database..
Now in Sharepoint portal, User should be able to enter reason for not meeting expectations for that month...
Any suggestions abt how to develop this project would be greatly appreciated.
Sudhie
|
|
|
|