Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Storing a variable name in SQL Server.

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-11-25 : 06:55:12
Rick writes "Hi, thanks for your great web site.

I want to store the text 'Session("surveyyear")' in a SQL Server field called fieldx, then retrieve and use it to assign the value to an asp code variable.

example: abc = rs1("fieldx")
where rs1 is the SQL Server recordset.

I would like abc to equal the value of the session variable, not the 'Session("surveyyear")' literal.

Thanks again,

Rick"

ValterBorges
Master Smack Fu Yak Hacker

1429 Posts

Posted - 2002-11-25 : 09:41:20
Assuming you know the ADO portion.

The insert Command.
objCmd.Text = _
"INSERT INTO SurveyTable (id,fieldx) " & _
"VALUES(" & Session("ID") & ",'" & Session("surveyyear") & "')"

The select Command.

objCmd.Text _
"SELECT fieldx " & _
"FROM SurveyTable " & _
"WHERE id = " & Session("ID")


Go to Top of Page
   

- Advertisement -