Coder Social home page Coder Social logo

Comments (4)

CaldwellYSR avatar CaldwellYSR commented on August 16, 2024 1

Sorry, I was going back and forth with the guy the wrote the SQL in question and I think we were wrong about the problem. We tested with another couple queries that had similar casting but they didn't give the same issue. We are thinking the issue might be coming from something weird he is doing with the date variable that's being passed into the query. Unfortunately the query is 1500+ lines long so debugging it is a bit outside my scope.

I will get back to you if we get anywhere with it.

from tds.

moogle19 avatar moogle19 commented on August 16, 2024

Hi @CaldwellYSR ,
I tried to reproduce your problem, but in my example it seems to work.

I tried the following:

iex> Repo.query("CREATE TABLE varchar_test (top_pick_sentence varchar(499))")
{:ok, %Tds.Result{columns: nil, num_rows: 0, rows: nil}}

iex> Repo.query("INSERT INTO varchar_test VALUES ('some veeeeeeeeeeeeeeeeeeeeeeeeerrrrrrrrrrrrrrrrrrryyyyyyyyyyyyyyyyyyyyy long string')")
{:ok, %Tds.Result{columns: nil, num_rows: 1, rows: nil}}

iex> Repo.query("select cast(top_pick_sentence as nvarchar(max)) as top_pick_sentence from varchar_test", [])
{:ok,
 %Tds.Result{
   columns: ["top_pick_sentence"],
   num_rows: 1,
   rows: [
     ["some veeeeeeeeeeeeeeeeeeeeeeeeerrrrrrrrrrrrrrrrrrryyyyyyyyyyyyyyyyyyyyy long string"]
   ]
 }}

Could you try the example above in your environment and maybe enable debug output for the queries, which are problematic, so I can take a look at the raw SQL queries?

from tds.

moogle19 avatar moogle19 commented on August 16, 2024

@CaldwellYSR
Any chance you could supply me with some debug output for the problem?

from tds.

CaldwellYSR avatar CaldwellYSR commented on August 16, 2024

@moogle19 I guess I'm going to close this issue because it's clearly incorrect. The SQL guy has given me a new query that works even when casting to nvarchar so clearly the casting isn't the issue. He believes the issue was related to that query using a ton of unions but he doesn't know that for sure.

If we find out what broke it I will create another issue.

from tds.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.