I have the following where clause...Right now it is slow.It is anyway I can speed up by rewriting differently??
and ( b.ID1 = a.ID1
or b.ID2=a.ID2
or (Replicate ('0',11-len(b.ID3)) + b.ID3)=a.ID3)
AND ( a.ID1 = @ID
or (Replicate ('0',11-len(a.ID3)) + a.ID3)=@ID
or a.ID2=@ID)
What is wrong with my query?It will not compile
insert into table1
(GID, SID, DateEntered)
values (
select GID,SID,getdate()
from table2
where GID='1' and SID
not in (select SID from table3
where GID='1')
)
I am trying to create a triger for insert. I would like to get id into log table id data was inserted.What am I doing incorrect:
if exists (select * from dbo.sysobjects where id = object_id('dbo.mstr_update')
and OBJECTPROPERTY(id, 'IsTrigger') = 1)
drop trigger dbo.mstr_update
GO
CREATE...
Is it posible to create a file using a activex script as well as exec sp in activex and save the data into file created by activex? can some one show me the examples?
Here is my code for CDOMail. However when I try to send to attachemnt it will not work (working with one attachment only). Any idea why?
CREATE PROCEDURE CDO_SendMail(
@From varchar(255) = 'sql@msn.com',
@To varchar(255),
@Cc varchar(255) = '',
@Bcc varchar(255) = '',
@Subject...
I have a param @MessageBody varchar(8000).
I am assigning some values to the select @MessageBody=select.... It working fine until I the results is only 1 row, however when it is more then one it is taking only top 1 row. What should I do in order to get all rows?
I am trying to copy an .xls file. However when I am using a
fso.CopyFile FName, DstFName I need to know the file destination. But in my case I would like to copy a file from one place to other where desctination file is not exists. How do I do this?
I have the following code where I have some subquery. However my subquery return more than 1 row. Is it some how I can put all subquery result in 1 row instead of couple?
select Custom1=(select case Answer when 'Yes' then 'Y' else 'N' end + ' '
fromAnswers wa where wa.tranid=wt.TranID )...
I have a simple Process task where my win32 process.value is cmd.exe
Parameters:copy \\ServerName\d$\Archive\Out\File.xls \\ServerName\d$\users\Out\ /Y
Cope file from one location to the other. when I run this line in cmd it is fine, howere when I run in dts it just hang up.Any idea why?
I have the following query . My result is displaying as 1 column and 5 row. I would like to have all results in 1 row and 1 column. How do I do this?
select case answer when 'Yes' then 'Y' Else 'N' end as Custom1 from answers
I am trying to redirect statement to a different db by using Use database statement in sp. however it is not alloud me to do.
What should I use instead?
In my DTS I have thhi line:
Main= DTSTransformstat_InsertQuery
However sometimes my insertQuery is failing.
How do I find if Insert was sucess or fails?
I have set of Union statements.I need to validate param if param='123'
then do one more union if not end of select.
When I ran the sp it gives me an error in the union in if statement.
What am I doing incorrect?
Select 1,2,3 from table1
UNION
Select 1,2,3 from table2
...
If @param='123'
Begin...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.