开发者

Inserting a Hard Coded Value Into a Table

I'm looking to understand how I can insert a hard coded value into a table during an insert of a specific pull of data. The code below should give an idea of what I am trying to do...It's basically grab a certain set of Us开发者_JS百科erIDs and drop them into another Table and hardcode a value called 'Trial' into the column next to the UserID.

Is something like this easy/possible?

Insert Into LastSubscriptionWasTrial (UserId,**'HARDCODEVALUEHERE'**)
SELECT UserId
FROM  ....(Pulling my list of UserIDs here)


As originally written your INSERT statement is missing its VALUES specifier, so it's looking for a column name when it finds 'Trial'. It's unclear whether UserId is a column or a variable name so I can't suggest a correct statement.


unless I am totally missing something from your question you should be able to do the following, you just have to put the value you want hard coded in your statement.

Insert Into LastSubscriptionWasTrial (UserId, TrialField)
SELECT UserId, 'Trial' FROM ....(Pulling my list of UserIDs here)
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜