Viewing 15 posts - 76 through 90 (of 110 total)
The answer depends a lot on how they are entering the data in the first place. Is there a custom frontend app or fancy gui? If there is, then that...
March 13, 2008 at 7:51 pm
Is it true that the lower number sysids belong to earlier dates than higher number sysids so that 93291 Print Bound Pty Ltd is the row you want for job...
March 11, 2008 at 7:02 pm
This looks like homework and is not a sql server issue, so I am only posting pseudocode.
make a new date var as Jan 1 + the year part of...
March 10, 2008 at 6:09 pm
Almost. Your code deletes records whose ssn equals the string 'ssn'. You want a variable instead.
create proc up_EmpDelete
@SSN char(9)
as
DELETE FROM employee WHERE ssn=@ssn;
March 10, 2008 at 5:28 pm
We need more info. What are you trying to do with Leap Years? Is your project named "Leap Years" or are you trying to calculate what the next N leap...
March 10, 2008 at 5:21 pm
for your second question, the answer depends a lot on what other columns are in you table besides the 1s and 2s. How do you identify the sequence?
This code works...
March 7, 2008 at 5:16 pm
I would like to join the results of this procedure to a table, but have been unable to do it. I think I may be able to do it...
March 7, 2008 at 4:58 pm
Before we go too much farther, are you positive you need to use dynamic sql to do this archive? As you are experiencing, the more code you have to add,...
March 6, 2008 at 12:31 pm
I'll echo the suggestion to build strings and use print statements.
-- your other delares and sets then
declare @sql Nvarchar(1000)
set @sql = 'IF EXISTS( SELECT * from...
March 6, 2008 at 9:29 am
By the way, the 'use db' part seems odd. You can do this instead (mindful of the usual caveats about querying system tables):
exec(' if exists( select * from ' +...
March 5, 2008 at 3:49 pm
Try this:
EXEC ('USE '+ @ARCHIVEDB +'
IF EXISTS (SELECT * FROM SYSOBJECTS WHERE TYPE =''U'' AND NAME ='''+ @TABLENAME +''')
select 7 else select 8') -- for example only
March 5, 2008 at 3:43 pm
One thing you can do to shorten the code is skip the search for the id and go straight to the update. Then, check if any record is updated by...
March 4, 2008 at 7:50 pm
Do you mean to check if the string can become a table name or to check that a table with name = string exists?
March 3, 2008 at 5:42 pm
These are ugly answers but may help you along.
To simplify test code, I added computed columns to do the splitting of Lane
create table myTable (Lane char(5), stfr as left(lane, 2),...
March 1, 2008 at 9:20 am
Viewing 15 posts - 76 through 90 (of 110 total)