Viewing 15 posts - 46 through 60 (of 96 total)
Never used this..but check BOL on this..
DBCC CHECKIDENT ('table_name', RESEED, new_reseed_value)
HTH
Mathew J Kulangara
sqladventures.blogspot.com
February 6, 2006 at 12:02 pm
"I also checked the records in Tbl_Accounts - there are a few records with a null value in Basecurrency but all other records have a matching record in Tbl_Currencies."
Why do...
Mathew J Kulangara
sqladventures.blogspot.com
February 6, 2006 at 11:59 am
Something like this...
create table #Temp
(
Field1 some_date_type,
Field2 some_date_type,
Field3 some_date_type,
)
If [Condition1]
insert #temp( Field1,Field2, Field3)
Select Field1,Field2, Field3
from Table
order by Field3,Field2, Field1
Else
If [Condition2]
insert #temp( Field1,Field2, Field3)
Select Field1,Field2, Field3
from Table
order by Field3,Field2, Field1
Else
insert #temp( Field1,Field2,...
Mathew J Kulangara
sqladventures.blogspot.com
February 6, 2006 at 10:04 am
Pivoting the table works as Matthew mentions...but I'd probably do it something as follows..
declare @possible_answers table
(
possible_answer char(1)
)
declare @questions table
(
question char(1)
)
declare @results table
(
question char(1),
answer char(1),
tally int default 0
)
insert @questions
select question
from...
Mathew J Kulangara
sqladventures.blogspot.com
February 6, 2006 at 9:59 am
Create a DTS package..and create a batch file with a dtsrun acommand. Have the user run the batch file as needed.
HTH
Mathew J Kulangara
sqladventures.blogspot.com
February 6, 2006 at 7:55 am
If I'm understanding you...
select Distinct [ID],CustomerName,CustomerNumber,SalesmanName,Min(ItemDescription) AS ItemDescription,OrigionalDateofService,InsuranceCarrier, Diag1,Diag2,Diag3,Diag4 from O2
Group By
[ID],
CustomerName,
CustomerNumber,
SalesmanName,
OrigionalDateofService,
InsuranceCarrier,
Diag1,
Diag2,
Diag3,
Diag4
By the way if {id] is trully an identity column ..you shouldn't need distinct at all.
HTH
Mathew J Kulangara
sqladventures.blogspot.com
February 6, 2006 at 7:53 am
Well one thing is you'd have to determine what "id" you want to return. Do you just return one of them for each distinct set you have or ..do...
Mathew J Kulangara
sqladventures.blogspot.com
February 6, 2006 at 7:47 am
Still not sure exactly what you need. What is your DDL, and what is an example result you are expecting ?
Mathew J Kulangara
sqladventures.blogspot.com
February 4, 2006 at 2:17 pm
I'd do it like this...
declare @table table
(
[id] int primary key identity(1,1),
value float
)
declare @results table
(
[id] varchar(50) primary key,
value float
)
declare @low int,
@high int
set @low = 0
set @high = 1000
while @low <= @high
begin
insert...
Mathew J Kulangara
sqladventures.blogspot.com
February 4, 2006 at 2:14 pm
Your DDL would be helpful.
Mathew J Kulangara
sqladventures.blogspot.com
February 4, 2006 at 12:47 pm
something like this...
insert results_table(User_id,LessonId,Num_Abset)
select user_id,lesson_id,count(*) Num_absent
from SomeTable T
where t.status = 'Absent'
group by t.user_id,t.lesson_id
having count(*) = 5
Mathew J Kulangara
sqladventures.blogspot.com
February 4, 2006 at 5:51 am
If I'm understanding you correctly..a simple join..
Select M.*,D.*
from MasterTable M
join DetailTable D
on M.ID = D.ID
HTH
Mathew J Kulangara
sqladventures.blogspot.com
February 4, 2006 at 5:41 am
try ..
SELECT TOP 10
S.id_solicitud,
CONVERT(NCHAR(10), S.fecha_creacion, 120) AS fecha_creacion,
S.nombre,
S.clave_material,
IsNull(CONVERT(NCHAR(10), S.fecha_ini_pruebas, 120), 'N/A') AS fecha_ini_pruebas,
IsNull(CONVERT(NCHAR(10), S.fecha_fin_pruebas, 120), 'N/A') AS fecha_fin_pruebas,
IsNull(CONVERT(NCHAR(10), S.fecha_emision_reporte, 120), 'N/A') AS fecha_emision_reporte
FROM
dbo.tblSolsInstrum_Solicitudes S
WHERE
id_usuario = 'car6527'
ORDER BY
2...
Mathew J Kulangara
sqladventures.blogspot.com
February 3, 2006 at 11:29 am
Have your script file update a log file. Before executing the next step in your program, check the log file to make sure log says the script ended sucessfully....
Mathew J Kulangara
sqladventures.blogspot.com
February 3, 2006 at 10:53 am
Check out the books that helped me pass on my blog.
Good luck.
HTH
Mathew J Kulangara
sqladventures.blogspot.com
February 3, 2006 at 9:28 am
Viewing 15 posts - 46 through 60 (of 96 total)