Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search results for query: *

  1. clapag22

    Need help to intrepret SQL code

    Looks like it returns the first day of the month for the date you pass in. Change mydate to 10/17/2010 and run. You will get 10/1/2010.
  2. clapag22

    Updating a field in a table..

    update goals set emp_property = 'Westin' where emp_property = 'The Westin'
  3. clapag22

    Change SQL Service User Password

    Thanks to both of you for your suggestions!!
  4. clapag22

    Change SQL Service User Password

    I am doing work for a client who uses SQL Server 2000. I told them I need to log into the server as the Windows user the SQL Service is running as so that I can set up some drive mappings and such that they need the server to have. However, they informed me they lost the password and have no...
  5. clapag22

    Update Trigger

    Ohhh... Well, following your logic from above it would be something like this (I'm assuming deprtmnt is your PK): CREATE TRIGGER [trgDeleteUPR40300_kml] ON [dbo].[UPR40300] for delete AS delete from gpviews.dbo.upr40300 where dbase='two' and deprtmnt in (select deprtmnt from deleted)
  6. clapag22

    Update Trigger

    If you're trying to do the same thing, joining to the deleted table instead of the inserted table should give you what you need. You also don't need the "If Update" logic. Just the update statement itself.
  7. clapag22

    Update Trigger

    If you're doing the same thing regardless of update or delete you could just do this: CREATE TRIGGER [trgUpdateUPR40300_kml] ON [dbo].[UPR40300] for update, delete If you need it do something different you'd want to create a separate trigger starting like this: CREATE TRIGGER...
  8. clapag22

    Update Trigger

    You say, "when that field is changed on the front end" but your trigger appears to be an insert trigger only. Therefore it only fires when the row is inserted: CREATE TRIGGER [trgUpdateUPR40300_kml] ON [dbo].[UPR40300] for insert Try this: CREATE TRIGGER [trgUpdateUPR40300_kml] ON...
  9. clapag22

    Cannot Alter Table / Replication

    What happens when you run: exec sp_helpreplicationdboption go How many changes do you need to make? If it's only a couple you can do something like this on a replicated DB: alter table address add XCoord_bak decimal(8,5) GO update address set XCoord_bak = XCoord GO exec sp_repldropcolumn...
  10. clapag22

    Cannot Alter Table / Replication

    Try running sp_removedbreplication on the db in question.
  11. clapag22

    Combine two queries into one - Possible?

    I have a table called "CLAIMS". It contains these fields among others: MemberID ClaimID PaidAmt ProviderID ServiceDt PaidDt A ClaimID can be adjusted and contain multiple lines (for example, a claim is paid at $59, then a second line may take back the amount ($-59) and a third line may repay...
  12. clapag22

    Get Old Value in Update Trigger

    Not trying to be picky but that above trigger would not work if you had a multi-row update. You'd need to do something like this: CREATE TRIGGER Test_Update ON bob FOR UPDATE AS insert into bob2 (idnumber, n) SELECT idnumber, n FROM Deleted Craig
  13. clapag22

    Can you use column aliases in Replication?

    I'm not sure what your customers are doing with their data but one option would be to create a view of the table in question and then you can name each field whatever you wish. Then have the customers access the view. Of course, if you're talking about some sort of front end app that...
  14. clapag22

    [b]Problems Extracting Names using Substring and Charindex [/b]

    declare @v varchar(50), @pv varchar(50), @name1 varchar(20), @name2 varchar(20) select @v = 'Mr Dunne and Mrs Dunne' if @v like 'mr%and mrs%' begin select @pv = replace(@v, 'mr ', '') select @name1 = left(@pv, patindex('% %', @pv) - 1) select @name2 = reverse(left(reverse(@pv)...
  15. clapag22

    Replication Error - The row was not found at Subscriber...

    This usually occurs during transactional replication when the Primary Key value of the row being updated does not exist in the subscriber. So the upd SP can't find anything to update.
  16. clapag22

    Update syntax - scratching head!!

    vongrunt's is more elegant than mine, but since I typed it already I'll post it anyway... So if data exists for BedNo1/Time1 in TableA is it always true that data wouldn't exist for BedNo1/Time1 in TableB? If that's the case, then what I would do is to make a view that's a union of the two...
  17. clapag22

    Crosstab Query

    select staffno, datadate, sum(case when worktype = 'a' then data1 else 0 end) as adata1, sum(case when worktype = 'a' then data2 else 0 end) as adata2, sum(case when worktype = 'b' then data1 else 0 end) as bdata1, sum(case when worktype = 'b' then data2 else 0 end) as bdata2, sum(case when...
  18. clapag22

    Concat Text

    Does this make it any clearer? create table my_comments (pkid int not null identity(1,1), comments text) GO set nocount on declare @ptrval binary(16), @current_comment_len int, @new_comment varchar(8000), @pkid int select @pkid = 1 --or whatever you need it to be to test select...

Part and Inventory Search

Back
Top