Search Results

Search found 5 results on 1 pages for 'mikecancook'.

Page 1/1 | 1 

  • Retrieve Value Using Key From a Collection in Access 2000

    - by Mikecancook
    I know this is a simple question but it's aggravating me. If I have a key/value pair in a collection but I can't seem to get the value out using the key. I can get the key using the value but not vice versa. Is there some magical way to accomplish this? For example: Dim CycleList As Collection Dim Value as String Set CycleList = New Collection CycleList.Add 1, "Some Value" Value = CycleList(1) I've also tried CycleList.Item(1) and it's the same result, Value = 1.

    Read the article

  • How Do I Escape Apostrophes in Field Valued in SQL Server?

    - by Mikecancook
    I asked a question a couple days ago about creating INSERTs by running a SELECT to move data to another server. That worked great until I ran into a table that has full on HTML and apostrophes in it. What's the best way to deal with this? Lucking there aren't too many rows so it is feasible as a last resort to 'copy and paste'. But, eventually I will need to do this and the table by that time will probably be way too big to copy and paste these HTML fields. This is what I have now: select 'Insert into userwidget ([Type],[UserName],[Title],[Description],[Data],[HtmlOutput],[DisplayOrder],[RealTime],[SubDisplayOrder]) VALUES (' + ISNULL('N'''+Convert(varchar(8000),Type)+'''','NULL') + ',' + ISNULL('N'''+Convert(varchar(8000),Username)+'''','NULL') + ',' + ISNULL('N'''+Convert(varchar(8000),Title)+'''','NULL') + ',' + ISNULL('N'''+Convert(varchar(8000),Description)+'''','NULL') + ',' + ISNULL('N'''+Convert(varchar(8000),Data)+'''','NULL') + ',' + ISNULL('N'''+Convert(varchar(8000),HTMLOutput)+'''','NULL') + ',' + ISNULL('N'''+Convert(varchar(8000),DisplayOrder)+'''','NULL') + ',' + ISNULL('N'''+Convert(varchar(8000),RealTime)+'''','NULL') + ',' + ISNULL('N'''+Convert(varchar(8000),SubDisplayOrder)+'''','NULL') + ')' from userwidget Which is works fine except those pesky apostrophes in the HTMLOutput field. Can I escape them by having the query double up on the apostrophes or is there a way of encoding the field result so it won't matter?

    Read the article

  • Use a SELECT to Print a Bunch of INSERT INTOs

    - by Mikecancook
    I have a bunch of records I want to move to another database and I just want to create a bunch of inserts that I can copy and paste. I've seen someone do this before but I can't figure it out. I'm not getting the escapes right. It's something like this where 'Code', 'Description' and 'Absent' are the columns I want from the table. SELECT 'INSERT INTO AttendanceCodes (Code, Description, Absent) VALUES (' + Code + ',' + Description + ',' + Absent')' FROM AttendanceCodes The end result should be a slew of INSERTS with the correct values like this: INSERT INTO AttendanceCodes (Code, Description, Absent) VALUES ('A','Unverified Absence','UA')

    Read the article

  • Best way to move a bunch of SQL Server 2005 tables to another Server?

    - by Mikecancook
    I've been looking for a way to move a bunch of tables, more than 40, to another server with all the data in them. I've looked around for scripts to generate inserts but so far I'd have to run them once for every table, then copy all the scripts over and then run them on the server. Seems like there is a better way. --Update-- My strategy for doing this may have been for naught. The end script, using MS SQL Server Publishing Wizard and Red Gates SQL Data Compare (excellent tool, btw) results in a file over 1GB. This makes my system plead for mercy and I'm not willing to risk crashing a clients server just opening the file to run it. I may have to rethink this whole thing and break down to just individual per table scripts. I'm not looking forward to that.

    Read the article

  • How to Delete Duplicate Rows in SQL 2000?

    - by Mikecancook
    I thought I had this figured out but it turns out I'm just deleting the first record. The following returns the duplicate rows. All have a count of 2. I just want to delete the first one for each duplicate record. select scorestudentid, scoreadvisor, scorecorrect, count(*) from scores where scoretestid = 3284 group by scorestudentid, scoreadvisor, scorecorrect having count(scorestudentid) > 1 Which returns: scorestudentid scoreadvisor scorecorrect no column name 13033719 28059 3.0 2 13033777 28086 3.0 2 13033826 28147 3.0 2 13033960 28023 3.0 2 So I put this together thinking it would work: set rowcount 1 delete from scores where scoretestid = 3284 and scorestudentid in ( select scorestudentid from scores where scoretestid = 3284 group by scorestudentid having count(scorestudentid) > 1) It really seems like it should be a simple concept but I'm not getting it.

    Read the article

1