Converting an old VPF program to TSQL and need assistance

  • The prior DBA used FoxPro for a utility. I am rewriting it in SQL and need assistance with a command. At a certain time he uses Sys(2017, '',0, 3) for a CRC value. I do not know how to compute the same value in SQL. Any help would be much appreciated. I know the Sys(2017) has something to do with the row where:
    Sys(2017) is the command.
    '' is the expression and means it does not exclude fields except for memo and general fields.
    0 is the nseed where it does nothing because for CRC32 VFP disregards this.
    3 is the flag where I tells it to be based on the current record including memo fields using CRC32.

    Thanks

  • bswhipp - Thursday, July 13, 2017 7:15 AM

    The prior DBA used FoxPro for a utility. I am rewriting it in SQL and need assistance with a command. At a certain time he uses Sys(2017, '',0, 3) for a CRC value. I do not know how to compute the same value in SQL. Any help would be much appreciated. I know the Sys(2017) has something to do with the row where:
    Sys(2017) is the command.
    '' is the expression and means it does not exclude fields except for memo and general fields.
    0 is the nseed where it does nothing because for CRC32 VFP disregards this.
    3 is the flag where I tells it to be based on the current record including memo fields using CRC32.

    Thanks

    I haven't touched VFP in a long time, but by the description, maybe CHECKSUM or BINARY_CHECKSUM could work for you.

    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
  • MSDN info here
    https://msdn.microsoft.com/en-us/library/aa977006(v=vs.71).aspx

    ________________________________________________________________
    you can lead a user to data....but you cannot make them think
    and remember....every day is a school day

  • J Livingston SQL - Thursday, July 13, 2017 7:29 AM

    I am looking at the Checksum() but am not 100% sure how to use it.

  • bswhipp - Thursday, July 13, 2017 7:32 AM

    J Livingston SQL - Thursday, July 13, 2017 7:29 AM

    I am looking at the Checksum() but am not 100% sure how to use it.

    CHECKSUM(Field1, Field2, Field3, ...)

    Using it is as easy as adding as many fields from the table to the function as you want it to compute a checksum on.   Just be aware that collisions ARE possible.

    Steve (aka sgmunson) 🙂 🙂 🙂
    Rent Servers for Income (picks and shovels strategy)

  • Thanks, but you would think there would be a better way. I have several fields that need to be included to see if I can replicate the same checksum as the sys() function.

Viewing 6 posts - 1 through 5 (of 5 total)

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