View referencing table with ## in the name?

  • I am trying to get an old SQL2000 DB to run on at least SQL2005. Can't move it up to SQL2008 because it uses deprecated features in the SQL procs (old *= and *= type joins). 🙁

    I have a couple views that won't bind because the tables don't exist. The SQL in them is:

    CREATE VIEW [dbo].[IN_RP_ISTD_VENDA4] (ITEMNUM, VENDORID) AS

    SELECT ITEMNUM, VENDORID FROM IN_RP_ISTD_VEND##14

    UNION SELECT ITEMNUM, VENDORID FROM IN_RP_ISTD_VEND##24

    GO

    Tables IN_RP_ISTD_VEND##14 and IN_RP_ISTD_VEND##24 do not exist, nor are they other views, or even functions. Anyone have any idea what they could be?

    Any insight would be appreciated.

    Thanks

    Lori

  • Synonyms?

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • FYI, the =* and *= can easily be converted to Outer Joins so you could upgrade to SQL 2008 or higher.



    Alvin Ramard
    Memphis PASS Chapter[/url]

    All my SSC forum answers come with a money back guarantee. If you didn't like the answer then I'll gladly refund what you paid for it.

    For best practices on asking questions, please read the following article: Forum Etiquette: How to post data/code on a forum to get the best help[/url]

  • Wow. That's just rude and unhelpful. You know nothing about me, my level of experience, my situation, or what I have done prior to getting to this point. I totally understand sarcasm, but your response is unprofessional and uncalled-for. Perhaps you should practice putting a filter on your thoughts before committing them to public.

    Let me clarify that my first, second and third conversations with my boss and user about this project was this is not a good idea, we should be investing the money required to either get this application up to current versions, or replace it with a newer product. However, they want to try this approach first. Also, I am doing this on a dev server, which is not being used anymore, but hasn't been removed from our environment just yet. So.....

    Anyone have something helpful to say?

    Lori

  • the suggestion to check for synonyms is solid; i did not think that was sarcastic at all; it would have been my first guess as well.

    there's an excellent chance that what you are seeing is an artifact and that it's legacy code that doesn't work at all.

    can you actually select from the view in the original SQL2000 or 2005 source?

    it's certainly possible to have invalid objects, where the object was created, but then the underlying tables it depends on were removed. that's what i think is probably happening here.

    in the case of the view, if the table was removed or renamed, but the view wasn't updated, i'd expect an invalid object reference that you are encountering.

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • Sorry - Luis - I was responding to your tag line, and not your comment.

    Still....

    This is code in a purchased app. I am not comfortable changing it. Just trying to get it to work or to prove that we cannot run it on a newer version without a newer version of the code.

    But I have to be able to explain to the user specifically why they will need to shell out $$ when they don't want to.

    I don't think it is a synonym or alias, as it will gives a binding error when I run sp_refreshvw.

    Lor

  • oops



    Alvin Ramard
    Memphis PASS Chapter[/url]

    All my SSC forum answers come with a money back guarantee. If you didn't like the answer then I'll gladly refund what you paid for it.

    For best practices on asking questions, please read the following article: Forum Etiquette: How to post data/code on a forum to get the best help[/url]

  • Reactions like this make me wonder if I should change my signature.

    Those questions are there because some people just copy, paste and execute code without analysing what they do. I'm sorry for the bad taste they leave, but I feel obligated to prevent people from bad options (which might come from me).

    Lowell might be correct on guessing that the objects might not exist anymore and the view is part of some legacy code. You might want to check if the application uses this view anywhere or anytime.

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • Luis Cazares (5/20/2015)


    Reactions like this make me wonder if I should change my signature.

    Those questions are there because some people just copy, paste and execute code without analysing what they do. I'm sorry for the bad taste they leave, but I feel obligated to prevent people from bad options (which might come from me).

    Lowell might be correct on guessing that the objects might not exist anymore and the view is part of some legacy code. You might want to check if the application uses this view anywhere or anytime.

    You could reword it. Instead of asking the question, you could remind everyone to test before using.

    Just an idea. I won't bill you for that $0.03 😎



    Alvin Ramard
    Memphis PASS Chapter[/url]

    All my SSC forum answers come with a money back guarantee. If you didn't like the answer then I'll gladly refund what you paid for it.

    For best practices on asking questions, please read the following article: Forum Etiquette: How to post data/code on a forum to get the best help[/url]

  • I am trying to get an old SQL2000 DB to run on at least SQL2005. Can't move it up to SQL2008 because it uses deprecated features in the SQL procs (old *= and *= type joins). 🙁

    Actually, this shouldn't be as big of a concern. You should be able to upgrade to SQL Server 2008 R2 and still be able to use the old join syntax. You might have to keep the compatibility level of the database at 80 but it should work. The feature is deprecated, not removed.

    Deprecated Database Engine Features in SQL Server 2008 R2

    Joie Andrew
    "Since 1982"

  • Luis Cazares (5/20/2015)


    Reactions like this make me wonder if I should change my signature.

    Those questions are there because some people just copy, paste and execute code without analysing what they do.

    I like your signature line and the message; it's good advice. I would not let a little misunderstanding cause you to change it. That's my $0.02.

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

Viewing 11 posts - 1 through 10 (of 10 total)

You must be logged in to reply to this topic. Login to reply