Viewing 15 posts - 61 through 75 (of 413 total)
I'm not completely sure what you want, but this query produces the result you are after:
insert [tblQuiz_Respuesta] select 2003128001, 3, 'Quellón', 25
insert [tblQuiz_Respuesta] select 2003128001, 2, 'Castro', 197
insert [tblQuiz_Respuesta] select...
February 16, 2006 at 1:39 am
Much easier than what I proposed before
declare @YourTable table(CodUser int, [From] int, [To] int)
insert @YourTable select 1, 120, 240
insert @YourTable select 1, 150,...
February 16, 2006 at 1:22 am
As I said, it's a well-known trick - I have learned it here at SSC...
February 15, 2006 at 4:39 am
You need more numbers in your #Nums table
Apart from that, I think I would start by unpivoting data. Then I'd split it to...
February 15, 2006 at 3:30 am
Yes, I think the main problem is naming the time column. Use "as xxx", like Veeresh above. Also explicit conversion from datetime to varchar is preferable...
February 15, 2006 at 1:42 am
Try this:
declare @count int
declare @sql nvarchar(1000)
declare @tablename nvarchar(100)
select @tablename = 'yourtablename'
select @sql = N'select @count = count(*) from ' + @tablename
exec sp_executesql @sql,
February 14, 2006 at 1:26 pm
OK, then I will write down what I had in mind
It's a well-known trick... It's not as readable as your straightforward solution. On...
February 14, 2006 at 12:46 pm
Check out the "union" command in books online. If that doesn't help, please give us your table definition, sample data and expected output of the query.
February 14, 2006 at 6:04 am
"a field of datatype ntext"
February 14, 2006 at 1:04 am
Define #tempDone like Liliana defined #test, then slightly modify her code:
insert into #TempDone SELECT NAME,
CASE WHEN PATINDEX('%<BR>%', iq) > 0
THEN SUBSTRING(IQ, 1, PATINDEX('%<BR>%', iq) -1)
ELSE...
February 14, 2006 at 12:57 am
Very nice idea, PW...
An alternative - not at all better, but it's a different approach....
declare @YourTable...
February 13, 2006 at 1:27 pm
Well, I think what Sam should have done is the following: Define @lastitemsequence, @lastwearerid as above, then
declare @FirstOldItemSequence int
select @FirstOldItemSequence = isnull(min(itemsequence), 0) from CustomerWearerItems WHERE custid=100
and wearerid = 1
Insert...
February 13, 2006 at 7:11 am
Is this what you are looking for?
select
Ind_id as [Individual ID],
firstname as [First Name],
lastname as [Last Name],
occupat as Title
from individual1
where ind_id in
(
select A.payer_fk
from contribution1...
February 10, 2006 at 8:31 am
Perhaps examine @@ERROR after each SQL statement? Store the result in a table, then you will know which statement failed.
February 10, 2006 at 7:10 am
Try this:
declare @table table(period int identity(1,1), begdate datetime, enddate datetime)
insert @table (begdate, enddate) select '20060101', '20060129'
insert @table (begdate, enddate) select '20060130', '20060228'
select dateadd(dd, N.n, '20051231') as dateid, T.period, year(T.begdate) as...
February 10, 2006 at 6:40 am
Viewing 15 posts - 61 through 75 (of 413 total)