April 7, 2006 at 5:45 am
OK, I know what this is. The ID will have a data type of 'uniqueidentifier', probably with a default value of newid(). SQL Server will generate this for you on INSERT if the default is there. If not, just try INSERTing newid() and that should be it.
Phil
April 7, 2006 at 6:00 am
hi
so do you think the following statement will work:
INSERT INTO FamousFacesSubmissions ({4259348C-32B9-4153-BDC3-592E0F27C10F}, {F421AC0C-FD3E-4D57-99FB-6177B1840857}, GetDate())
Where the first one is storyID, second is subscriberID (know these are real) and DateSubmitted it pulls current date to provide?
and obviously if we have to add in newid() it would be as follows:
INSERT INTO FamousFacesSubmissions (newID(), {4259348C-32B9-4153-BDC3-592E0F27C10F}, {F421AC0C-FD3E-4D57-99FB-6177B1840857}, GetDate())
Is that all right?
April 7, 2006 at 6:16 am
It's best if you specify the fields that you are INSERTing into - also use single quotes and dump the curly brackets:
will generate a new PK for you.
Alternatively (if the default newid() PK is already in place on SQL Server):
April 7, 2006 at 6:34 am
Thank you so much!
I have now managed to add the basic record for the story submission.
Just need to work out now how to add in the long content part!
April 7, 2006 at 6:44 am
Ace.
What's the datatype of the content field?
April 7, 2006 at 6:57 am
hi
its a varchar and allows for 5000 characters
my concern is that the story page has things like " " and ' ' plus other things and also has paragraph breaks etc
It may be that I will need to get that issue resolved on the page submissions page so that I can update the record we added via that and paste in the story page via there
Or do you think it can be done via the database?
April 7, 2006 at 7:23 am
The single quotes will cause all sorts of problems, that's for sure! If you already have an ASP page that does (or should do) this, it will probably handle the formatting better. Best of luck.
April 7, 2006 at 7:41 am
Hi
ok thanks for letting me know, the page I mentioned is the page I initially posted about pagesubmissions.asp that had the error in. So I will have to try and crack that error.
Thank you for all your help though!
April 7, 2006 at 8:01 am
Well, I guess you could try this.
First off, replace all of the single quotes with something else - eg ~ or some other character that does not exist elsewhere in the content, er, contents.
Then you may be able to do this:
declare @storytext varchar(5000)
set @storytext = 'paste the content text here - single quotes replaced'
update FamousFacesSubmissions
set Content = @Storytext
where SubmissionID = 'paste in the ID of the newly created record here'
Then you need to put the single quotes back:
declare @SingleQuote char(1)
set @SingleQuote = ''''
update FamousFacesSubmissions
set Content = replace(Content, '~', @SingleQuote)
where SubmissionID = 'paste in the ID of the newly created record here'
Yuk, sorry it's not simpler. If you go down this road, be most careful to get the WHERE bit right, otherwise you'll end up updating the wrong row (or, worse still, all rows!).
April 7, 2006 at 8:35 am
thank you so much! I will try that out now.
Viewing 10 posts - 16 through 25 (of 25 total)
You must be logged in to reply to this topic. Login to reply