Viewing 15 posts - 91 through 105 (of 110 total)
The code that doesn't work does not work because @TimeSheet_PK_ID has no value at the time you ask to select...WHERE @TimeSheet_PK_ID = tbl_TimeSheetEntry.TimeSheet_PK_ID.
The part that you say seems redundant only...
February 29, 2008 at 5:18 pm
Your first Exists should start
IF EXISTS(SELECT * from ...
You cannot assign a variable within an EXISTS.
Since you are not setting @TimeSheet_PK_ID, your WHERE clause for the UPDATE should start WHERE...
February 28, 2008 at 8:32 pm
execute ('select DB1.dbo.getSomething(3)')
as login = 'MyLoginName'
at LinkedServerName
You can use login or user names. See BOL under EXECUTE (Transact-SQL).
February 25, 2008 at 8:23 pm
Look up INSERT and UPDATE in BOL. There are many ways to code this. The one you want may depend on requirements you did not mention.
Simplest thing would be insert...
February 25, 2008 at 12:58 pm
the table specs did not come through. please post them again.
February 20, 2008 at 5:45 pm
create table #test (aaa int, bbb int)
insert into #test select 1, 2
declare
@aaa int,
@bbb int
select @aaa = aaa + 2, @bbb = bbb + 3 from #test
select @aaa...
February 18, 2008 at 6:13 pm
Look under Security Catalog Views in BOL for your second question. sys.database_role_members is one such view.
February 18, 2008 at 6:03 pm
It seems like you need parentheses around the units part too. That's why your else statement ran even when @PayFormulaCode was not TS in one of the early versions.
declare @PayFormulaCode...
February 18, 2008 at 7:30 am
Where does the 26 come from?
If all of your names to parse look like 'Brown JohnF' this will work
create table #tblImportAppliedBankDaily (Details varchar(40))
insert into #tblImportAppliedBankDaily (Details) select 'Brown JohnF'
insert into...
February 15, 2008 at 5:01 pm
I'm partial to stating conditions positively so instead of not exists this uses exists and may finish a little quicker.
create proc CheckExists
@TableName varchar(100),
@ColumnName varchar(20),
@HolderNum int,
@DoesExist...
February 14, 2008 at 6:15 pm
Echoing the previous response but avoiding the local temp table and having to convert all of your stuff to do into dynamic sql as well as the test.
For exists() you...
February 14, 2008 at 5:33 pm
A table variable created outside of the dynamic sql is not visible within the dynamic sql. You can make and use the table variable within the dynamic sql.
declare @fname as...
February 13, 2008 at 5:51 pm
create table #test
(
FullName varchar(5), AddressHome varchar(10), AddressPO varchar(10), CustPhone char(10)
)
insert into #test
select 'allen', '1', null, 'any'
union
select 'betty', null, '22', 'any'
union
select 'chuck', '333', '4444', 'any'
union
select 'david', null, null, 'any'
select FullName,...
February 13, 2008 at 5:24 pm
bulk insert and bcp will work too. Both have a lot of options. This is about as simple as they get:
CREATE TABLE #MyFile (MyText VARCHAR(500))
BULK INSERT #MyFile
FROM...
February 11, 2008 at 8:03 pm
Some fixes based on guesses about what may not be working as you expect.
-- No results at all or syntax error because of the double quotes around 16285. Change to...
February 6, 2008 at 11:10 am
Viewing 15 posts - 91 through 105 (of 110 total)