Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9230051
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T05:43:31+00:00 2026-06-18T05:43:31+00:00

Work with SQL Server, using pdo_sqlsrv driver (PHP 5.4) In my DB I have

  • 0

Work with SQL Server, using pdo_sqlsrv driver (PHP 5.4)

In my DB I have column with varbinary type and size of 7584.

When I try to get value from this column I get this error

Invalid sql_display_size in G:\..\..\..\framework\yiilite.php on line 8836

Here is the query:

DECLARE @item varbinary(1728); SET @item = (SELECT Inventory FROM Character WHERE Name='CharName'); print @item;

In this case I get exactly that size that I need. It work in normal php query (not PDO) and in SQL Server Management Studio.

When I run this code in Yii:

$query = "DECLARE @item varbinary(1728); SET @item = (SELECT Inventory FROM Character WHERE Name='CharName'); print @item";
$command=Yii::app()->db->createCommand($query)->query();
$command->read();

I get this:

SQLSTATE[IMSSP]: The active result for the query contains no fields.

I think that I built a wrong query.

My question is, How to run a query like this in Yii ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T05:43:32+00:00Added an answer on June 18, 2026 at 5:43 am

    I resolved this issue. The PDO_SQLSRV driver works perfectly with MS SQL Server on Windows.

    The problem was that I was trying to execute the wrong query:

    $query = "DECLARE @item varbinary(1728); SET @item = (SELECT Inventory FROM Character WHERE Name='CharName'); print @item";
    $command=Yii::app()->db->createCommand($query)->query();
    

    Working query:

    $query = "DECLARE @items varbinary(max);SET @items = (SELECT Inventory FROM Character WHERE Name='$id');Select @items";
                $getI = Yii::app()->db->createCommand($query)->queryScalar();
    

    That’s all.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I work using SQL Server. I have 2 tables, Animal and Cat . When
work on SQL Server 2000. want to Automated Email Notifications using SQL Server Job
I am using MS SQL Server 2005 at work to build a database. I
I'm using Microsoft SQL Server Management Studio to work with a database. I'm only
At work, we have several applications with databases in a centralized SQL server. Whenever
I have a set of sql scripts which I send to SQL server using
Is it possible to log to an XML column in SQL Server using the
I have a asp.net-mvc website with a SQL server backend (using nhibernate for OR
We have an app that creates queues and services in SQL Server using the
I am having problems getting the 'ByAccount' aggregation to work in SQL Server Analysis

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.