Viewing 13 posts - 1 through 13 (of 13 total)
This is because of implicit conversions that happen due to the way you have written the case statements. If you rewrite it like this that would avoid the problem.
SELECT...
May 12, 2011 at 7:14 pm
Replace the C:\test.txt with your filename in the following.
insert into #Cust
select
c3.value('CustID[1]','int'),
c3.value('CustLastName[1]','varchar(10)'),
c3.value('DOB[1]','DATETIME'),
c3.value('(Address/Addr1)[1]','VARCHAR(100)'),
c3.value('(Address/City)[1]','VARCHAR(10)')
from
(
select...
May 12, 2011 at 5:47 pm
Not very clear from your post what option1, option2 etc. are - whether they are distinct columns in your DB table, or whether they are possible values in a column....
April 30, 2011 at 6:32 pm
In the code below, I may not have considered all the business logic that you have - such as can there be more than two rows in Temp3 table for...
April 30, 2011 at 6:24 pm
Ferguson (4/30/2011)
April 30, 2011 at 3:58 pm
Are the data types datetime or smalldatetime? If not - for example if the columns are varchar, this can happen. If so, cast the column to datetime or smalldatetime in...
April 2, 2011 at 7:33 pm
Except for the milliseconds part that does seem to be correct to me. From March 27, 2011 at 2:13:31.640 hours to May 26, 2011 at 2:13:31.640 there are exactly sixty...
March 27, 2011 at 9:18 am
I didn't quite follow your exact requirement, so I am partly guessing. Is it something like this that you are looking for?
create procedure dbo.BDValues
@colName varchar(31),
...
March 27, 2011 at 8:41 am
"start of sql rally", Wayne?! :--)
Made me look up what it is... thanks for using that as an example!
Srividya, I tested Wayne's code with dates other than the...
March 27, 2011 at 8:28 am
Create Procedure
{
@LastName Varchar(100) = null
}
as
select * from TBS_Names where (@LastName is null or lastname = @LastName)
go
But, before you go with this approach, also please read this blog about performance issues...
March 26, 2011 at 8:27 pm
Ashok do one of two things (or may be both):
a) My code is long and drawn out, specifically so the logic is clear. Look through the code and make the...
March 21, 2011 at 5:16 am
Here is one way of doing it. In this, I am not trying to be efficient or write compact code; instead I am trying to make my logic clear.
declare @tbl...
March 19, 2011 at 7:49 pm
Assuming it is the holiday dates that you want to store in a table, this gives you the number of holidays between the two dates:select @x_hol =isnull(count(*),0) from YourHolidayTable
...
March 19, 2011 at 4:44 pm
Viewing 13 posts - 1 through 13 (of 13 total)