if (7/2/10 & 3/2/10) < 4/2/10
begin
print ' ok'
end
else
begin
print 'not ok'
end
is like this can we use if condition
is it possible
But here in if condition i have changed whatever the dates but it only shows answer as " not ok "
whether the condition is right or wrong it shows only "not ok" can some one help me
...
int id = 1;
string chain = "(";
SqlDataReader dr = SqlHelper.ExecuteReader(string.Format("SELECT a.Id as x, c.Id as y From Friends b INNER JOIN Users a ON b.SenderId = a.Id INNER JOIN Users c ON b.ReceiverId = c.Id WHERE (c.Id = {0} OR a.Id = {0}) AND State = '{1}'", id, "ok"));
if (dr.HasRows)
...
Hi,
I have used column-based relations a lot in my projects like:
CREATE TABLE `user` (
id INT AUTO_INCREMENT PRIMARY KEY,
usergroup INT
);
CREATE TABLE `usergroup` (
id INT AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(50)
);
however, at work it seems some people do it using table-based relations like this:
CREATE TABLE `user` (
id INT...
Hi,
I am using SQL Sever 2005, VC 6 ++ and Crsystal Report API to print a report in a child window.
If the records vary Only by Milliseconds, Crystal Report is showing only the 1st record. Otherwise, it is perfectly fine.
I am picking the timestamp from SQL Server DateTime Field.
In Formula inside Crystal Report, i am only giving the...
Hi.
I can connect to remote SQL Server database and I want to create a local database copy on my system. How can I do it? When i try backup through Management studio I cannot copy backup file on my hard drive only on remote system hard drive. Copy database command also doesn't work because I have express version of SQL Server. And exp...
Assume I have some stored procedure (and I can't change it) which is returning a result set:
create procedure test_procedure
as
begin
select 1
end
I know that I can insert result set into table, so it would be hidden to the calling code:
declare @t table(i int)
insert into @t
exec test_procedure
Are there any other ways to h...
The CUST table below will be joined with ~10 tables.
For this subquery in particular, am I better off simply joining up directly with the Customer table and moving the subquery's 4-part WHERE clause to the main query's WHERE clause?
I'm primarily wondering if it is possible to cut down on the amount of processing that SQL Server has to...
I have the following SQL:
ALTER PROCEDURE [dbo].[SP_Products_GetList]
@CatID int,
@CatName int,
@SortBy varchar(50),
@SortType varchar(50)
AS
SELECT Products.ProductID, ProductName, MAX(Price) Price FROM Products
INNER JOIN ProductCategory
on Products.ProductID = ProductCategory.ProductID
INNER JOIN (
...
I have the following table:
CREATE TABLE FE_USER
(
userid int identity (321,4) CONSTRAINT userid_pk PRIMARY KEY,
username varchar(40)
);
Its corresponding history table is
CREATE TABLE FE_USER_HIST
(
userid int,
username varchar(40),
v_action varchar(50)
);
Every time an insert or update is occurred on FE_USER t...
I am writing a small utility to copy a database from a proprietary ODBC database into a SQL Server database. Everything is working great, except when I use SQLBulkCopy to copy over the data. It works in most cases, but not when it's trying to copy a TIME field into a SQL DATETIME. I get this error:
The given value of type TimeSpan fr...
I've got a query (for use in bug tracker.net) that calculates the number of bugs by week by status. But the query returns the week number, what I really want is the first date of the week
select datepart(wk, DateAdd(day, 0, DateDiff(day, 0, bg_reported_date)))
as [week], bg_status , st_name as [status], count(*) as [count]
fr...
Ok, here is the thing. My program saves an image into a SQL Server Database, the column being of image type. When I try to recover it, I get an ArgumentException from the Imagen.FromStream method.
The code that inserts the image is something like this:
Bitmap img = (Bitmap)pictureBox.Image;
MemoryStream m = new MemoryStream();
img.Save...
Here is my sample:
ALTER PROCEDURE EmpFirstName
@myParam int,
@empFName varchar(20) output
AS
BEGIN
SET NOCOUNT ON;
SELECT @empFName = empfname
FROM FE_QEMP
WHERE empno = @myParam
END
GO
myParam is the input and empFName will carry the output, so the procedure
should only take 1 parameter since empFName is the...
Using SQL Server. Ok, I'm making an in webpage cache system. I wanted to make a simple page rank system along with output. The problem is, I want to display the recordset with the highest relevance score per unique domain. One domain may have multiple records but with different titles, descriptions, etc. he probem is,instead of getting 1...
I have a department table filled with records. I would like to run a query or use the
management studio interface to export department records to an excel file. Format is not an issue, i just want to dump the records into excel. I know i can copy and paste, but this is not what i'm looking for.
...
Hi
I have problem with two parts of database diagram and I need your guidance:)
database has a lot of tables that one of them is about Employee ,the other is about Customer and ... ! I have problem with two tables (Product and OrderDetail) my Product table has 3 columns (ProductID,Name,Cost) and the Other table is OrderDetail that has th...
Hi
I need triggers window how can i find it in the sql server 2008 and 2007? thanks
...
Hi There,
I have a gridview with employees name, there is link to another page,with employee information,when the user click on the link, according to employee id get the employee information from database, in this page we can add photos or update them,which works fine,
the problem is when updating the photo, and click the link, I see ...
Suppose I have the following tables
Students (StudentId int Pk, StudentName nvarchar)
Lectures (LectureId Pk, StartDate, EndDate)
Enrollment (StudentID, LectureID)
When I execute the following query:
select StudentID From Students
I get 8 rows..
And when i execute:
select S.StudentID From Students S join Enrollment En On S.Student...
We run a website written in Java that uses JDBC with jTDS to access an SQL Server database.
Our database contains a complex stored procedure that typically takes 10 minutes to run. The stored procedure works fine if we execute it directly (say from SQL Server Management Studio) because it does not run in a transaction. But if we execute...