CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1

    How to INSERT INTO a temp table the value of a SQL variable

    I don't get where my syntax is goig wrong here, I am hoping someone can help me out?

    declare @pLevel varchar
    set @pLevel = (select cast(serverproperty('productlevel') as varchar(8000)))
    print @pLevel
    print len(pLevel)

    The output is:
    S
    1


    I believe that cast is cutting out the return value, but I am not certain why.


    At any rate, all I want to do is INSERT INTO a temp table the value of:

    SELECT ServerProperty('productlevel')

    Thanks in advance for the help,
    Bob

  2. #2
    Join Date
    Apr 2002
    Location
    Egypt
    Posts
    2,210
    Code:
    create table #myTemp (prop varchar(8000))
    insert into #mytemp 
    select cast(serverproperty('productlevel') as varchar(8000))
    select prop from #mytemp
    drop table #mytemp

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured