Showing posts with label type. Show all posts
Showing posts with label type. Show all posts

Sunday, March 25, 2012

(nothing = 0) = true !

I have a bit type field that can have values 0, 1 and NULL in SQL database.
I want to hide an image when the value is different from 0.
The expression used in the visibility.Hidden property is
"=First(Fields!myfield.Value, "DataSet1") <>0"
And when the database value is NULL this expression returns false.
Please help !
(a French user...)I really canâ't understand why something like that does not work. I always
have to use something like the following:
=iif(Expression, 1=1, 1=0)
I hope it helps you!
> I have a bit type field that can have values 0, 1 and NULL in SQL database.
> I want to hide an image when the value is different from 0.
> The expression used in the visibility.Hidden property is
> "=First(Fields!myfield.Value, "DataSet1") <>0"
> And when the database value is NULL this expression returns false.
> Please help !
> (a French user...)
>|||thanks for you answer but it doen't help me...
I made this test : expression "= nothing = 0" in a new field, it's return
true !
"Soan" wrote:
> I really canâ't understand why something like that does not work. I always
> have to use something like the following:
> =iif(Expression, 1=1, 1=0)
> I hope it helps you!
>
> > I have a bit type field that can have values 0, 1 and NULL in SQL database.
> > I want to hide an image when the value is different from 0.
> > The expression used in the visibility.Hidden property is
> > "=First(Fields!myfield.Value, "DataSet1") <>0"
> > And when the database value is NULL this expression returns false.
> >
> > Please help !
> >
> > (a French user...)
> >|||I haven't tried it myself, but you may want to try the following:
"=(First(Fields!myfield.Value, "DataSet1") <> 0) OR
(First(Fields!myfield.Value, "DataSet1") IS DBNull.Value)"
Hope this helps.
Andy
tonio932 wrote:
> I have a bit type field that can have values 0, 1 and NULL in SQL database.
> I want to hide an image when the value is different from 0.
> The expression used in the visibility.Hidden property is
> "=First(Fields!myfield.Value, "DataSet1") <>0"
> And when the database value is NULL this expression returns false.
> Please help !
> (a French user...)
>|||When comparing with NULLs you have to use "is Nothing".
E.g. =iif(Fields!myField.Value is Nothing, True-Part, False-Part)
--
This posting is provided "AS IS" with no warranties, and confers no rights.
"tonio932" <tonio932@.discussions.microsoft.com> wrote in message
news:C4E4FDE8-81C8-41E4-AE37-09671864812A@.microsoft.com...
>I have a bit type field that can have values 0, 1 and NULL in SQL database.
> I want to hide an image when the value is different from 0.
> The expression used in the visibility.Hidden property is
> "=First(Fields!myfield.Value, "DataSet1") <>0"
> And when the database value is NULL this expression returns false.
> Please help !
> (a French user...)
>|||I have noticed that when a column value from the database is null, doing
myfield.Value is the same as doing null.Value, which makes RS blow.
Andy Hardin wrote:
> I haven't tried it myself, but you may want to try the following:
> "=(First(Fields!myfield.Value, "DataSet1") <> 0) OR
> (First(Fields!myfield.Value, "DataSet1") IS DBNull.Value)"
> Hope this helps.
> Andy
>
> tonio932 wrote:
>> I have a bit type field that can have values 0, 1 and NULL in SQL
>> database.
>> I want to hide an image when the value is different from 0.
>> The expression used in the visibility.Hidden property is
>> "=First(Fields!myfield.Value, "DataSet1") <>0"
>> And when the database value is NULL this expression returns false.
>> Please help !
>> (a French user...)sql

Thursday, March 22, 2012

(Cancel this) Can’t paste into XML field in Management Studio.

Hi Folks,

It looks like Management Studio prevents pasting XML directly into a field of the type xml. Sometimes, it might be best to stay with varchar(max).

Original post below: >>

I want to paste some XML into an SQL Server 2005 xml type field, but the null is grayed out and paste simply does not work. What is going on?

Thanks,

Rob

Rob:

I see the same behavior. It appears to me that the COPY function is not active for the XML field and that you cannot directly modify it. You can copy from the XML field, but you cannot paste into it. I suggest that you use an XML query to update your field?

(b60010eb08b2) in sp_lock

What does these values (b60010eb08b2) mean under the resource column for a
KEY type when one runs sp_lock ?Hassan
It's a hashed value of the key which is locked. There is no way to reverse
engineer to determine the value of the key.
HTH
--
Kalen Delaney
SQL Server MVP
www.SolidQualityLearning.com
"Hassan" <fatima_ja@.hotmail.com> wrote in message
news:e$Lt0gWDEHA.2908@.TK2MSFTNGP09.phx.gbl...
> What does these values (b60010eb08b2) mean under the resource column for a
> KEY type when one runs sp_lock ?
>|||Kalen,
I was going over through your e book on Locking and Blocking and was
confused on the % threshold before the lock escalates.
On page 46 , you said 40% and on page 40, you mentioned 3%. Am i not
following something here ? Please clarify
thanks
"Kalen Delaney" <replies@.public_newsgroups.com> wrote in message
news:eXhmYnXDEHA.712@.tk2msftngp13.phx.gbl...
> Hassan
> It's a hashed value of the key which is locked. There is no way to reverse
> engineer to determine the value of the key.
> --
> HTH
> --
> Kalen Delaney
> SQL Server MVP
> www.SolidQualityLearning.com
>
> "Hassan" <fatima_ja@.hotmail.com> wrote in message
> news:e$Lt0gWDEHA.2908@.TK2MSFTNGP09.phx.gbl...
a
>|||i also wanna reverse the key value by hashed value ,
because i wanna know the keys locked !

>--Original Message--
>Hassan
>It's a hashed value of the key which is locked. There is
no way to reverse
>engineer to determine the value of the key.
>--
>HTH
>--
>Kalen Delaney
>SQL Server MVP
>www.SolidQualityLearning.com
>
>"Hassan" <fatima_ja@.hotmail.com> wrote in message
>news:e$Lt0gWDEHA.2908@.TK2MSFTNGP09.phx.gbl...
resource column for a
>
>.
>|||Not doable... sorry
Wayne Snyder, MCDBA, SQL Server MVP
Computer Education Services Corporation (CESC), Charlotte, NC
www.computeredservices.com
(Please respond only to the newsgroups.)
I support the Professional Association of SQL Server (PASS) and it's
community of SQL Server professionals.
www.sqlpass.org
"rainbow" <anonymous@.discussions.microsoft.com> wrote in message
news:b6bd01c40d8e$1df948d0$a001280a@.phx.gbl...
> i also wanna reverse the key value by hashed value ,
> because i wanna know the keys locked !
>
> no way to reverse
> resource column for a|||Hi Hassan
If you read the entries sentences again, you'll see they see two separate
things. On page 40, it says 3% of memory, on page 46, it says 40% of buffer
pool.
The 40% figure is much more exact. (The 3% figure is just one that a dev
tossed at me when I asked when lock esacation occurs, and he said it was
related to the total memory used, something like 3%. So on page 40 I did say
ABOUT 3%.)
HTH
--
Kalen Delaney
SQL Server MVP
www.SolidQualityLearning.com
"Hassan" <fatima_ja@.hotmail.com> wrote in message
news:uDT$S8XDEHA.3348@.TK2MSFTNGP11.phx.gbl...
> Kalen,
> I was going over through your e book on Locking and Blocking and was
> confused on the % threshold before the lock escalates.
> On page 46 , you said 40% and on page 40, you mentioned 3%. Am i not
> following something here ? Please clarify
> thanks
> "Kalen Delaney" <replies@.public_newsgroups.com> wrote in message
> news:eXhmYnXDEHA.712@.tk2msftngp13.phx.gbl...
reverse
for
> a
>

((0)) set as Default Value or Binding for an int Data Type

Hi there,

I'm trying to set an int type attribute to 0 for its Default Value, but it keeps reverting to ((0)). What is causing this?

Every int type attribute on that table does the same. There is one bit type attribute and a bunch of other type of attributes, but non of them are giving me a problem. The table is a copy from another database and I did check all the constraints and properties to make sure they're the same.

Thank you,

--Alex

That is normal behavior for SSMS.

Thursday, March 8, 2012

"large value" data type(bcp)

I want to store some binary things(pic and so on), so I create a table which contain a a "varbinary" data-type column.

but 1. I used OPENROWSET to insert the large file in this table. 2. I used master..xp_cmdshell to retrieve data out as a file. One strange thing happened: the size of the input and output is really different(output is 1k bigger than the input file).

and it seems that the file is broken with different file format......

I really don't know why....

Any help would be appriciated.....

kavin

Could you please post a simple repro script? What command or utility are you using with xp_cmdshell to create the file? Is it BCP or OSQL with SELECT or BCP with queryout option and so on?|||

yes, sure.

EXEC master..xp_cmdshell 'bcp " SELECT column1 FROM Products where id =1111111117 " queryout fileName -n -U sa -P -S yourserver.

Is it any problem?

Anyway, thanks.

BR,

kavin

|||and when I compare the two files, I found that it just the 8-bytes at the beginning of file are extra filled. So I'm afraid something wrong with the created file?

"image" limitation of 510 bytes

Hello,

I have a field in my SQL Server 2000 with type "varbinary(8000)" which I merge onto my SQL CE 2.0 database. On my SQL CE 2.0, this field becomes "image".

Based on Microsoft's site: http://msdn2.microsoft.com/en-us/library/aa257477(SQL.80).aspx, "image" is used if the size is not over 510; however, when I populate this field in SQL CE, the maximum size that is stored is 510 bytes. I have verified my source data was complete (2622 butes) when again when I check the size of the field after an insert, it had only 510 bytes.

What's the work-around?

Thank you.

Try to have a look at this post:

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=538886&SiteID=1

|||Thanks. I was using "SqlDbType.Binary" in my Parameters. "SqlDbType.Image" fixed it.

Tuesday, March 6, 2012

"Error converting data type nvarchar to real" using LIKE operator on CHAR column

View1 has a CHAR column of CharCol1. While using LIKE operator on this column, I receive below error.

Select * from View1 Where CharCol1 Like '%77%'

Msg 8114, Level 16, State 5, Line 1

Error converting data type nvarchar to real.

But all of below syntax works:

Select * from View1 Where CharCol1 like N'%77%'

Select * from View1 Where CharCol1 Like '77'

Select * from View1 Where CharCol1 = '77'

Why does SQL 2005 treat '%77%' as real? This used to be working in SQL 2000.

It works for me in SQL 2005. Are you sure your view's CharCol1 is really a character column, and hasn't been casted as real?|||

Actually the view was being used in SQL 2000 and after SQL 2005 upgrade, this error has started.

Last view used a view and that view also uses another view. There are three levels. But one of the views used in the first view is then joined in the last view which gives this error. Of course, this is not good programming but it was working in the previous version. Now, I have removed this join and carried the necessary columns from the first level thus I eliminated double joining of same view at the last level. This solved the problem.

Actually, the problem is that, I had tested this view and they were ok. But once I give a Where clause using a column from the double joined view, I get this error. Unfortunately, we encountered this error after upgrade and on the live system we had to fix it.

What I understand is that somehow in SQL 2005, we can get errors if the coding is not good and the views should be tested by giving "Where" clauses using all possible columns.

Hope this is clear.

Does anyone have comment on this?

Thursday, February 9, 2012

#&^%@#$ Report services...... OMG how do you set a report parameter in code....

Here's the error message..

Unable to cast object of type 'Microsoft.Reporting.WinForms.ReportParameter' to type 'System.Collections.Generic.IEnumerable`1[Microsoft.Reporting.WinForms.ReportParameter]'.

Here is the code

Dim rp = New Microsoft.Reporting.WinForms.ReportParameter

Me.RV1.ProcessingMode = Microsoft.Reporting.WinForms.ProcessingMode.Remote

Me.RV1.ServerReport.ReportServerUrl = New Uri("http://10.1.1.138/ReportServer/")

Me.RV1.ServerReport.ReportPath = "/test/rEmailInvoice"

rp.Name = "InvoiceNumber"

rp.Values.Add("0618050")

Me.RV1.ServerReport.SetParameters(rp) < get error message here.

Me.RV1.ShowParameterPrompts = False

Me.RV1.RefreshReport()

is it that hard to set a query parameter in code? I have looked through this newsgroup, looked through MSDN, read people's blogs and still can't find the answer. Why couldn't MS create a sample that uses reportparameters?

Has anyone done this in code. Will the world end tomorrow?

Help!?!

D

Hi Maniac,

ServerReport.SetParameters method is expecting a ReportParameters collection not a single ReportParameter

here is a sample:

ReportParameter[] reportParams = new [1];

reportParams[0] = new Microsoft.Reporting.WebForms.ReportParameter("InvoiceNumber", "0618050");

RV1.ServerReport.SetParameters(reportParams);

That's it!

|||

I tried your code..

Dim reportparams() As ReportParameter = New (1) <-- on the open paren I get a "Type expected" error

reportparams(0) = New Microsoft.Reporting.WinForms.ReportParameter("invoicenumber", "0618050")

Me.RV1.ServerReport.SetParameters(reportparams)

What am I missing?

|||

I'm not sure of the syntax in VB but I think the syntax to declare an array of 1 element is a bit different isn'it ?

something like Dim reportParams() As new ReportParameter(1) ?

Don't know exactly how to declare an array in VB but it should be something like that

|||

THANKS! for your help. I got it working..

Here's the code for anyone else who might have the this problem.

Dim reportparams(0) As ReportParameter

Me.RV1.ProcessingMode = Microsoft.Reporting.WinForms.ProcessingMode.Remote

Me.RV1.ServerReport.ReportServerUrl = New Uri("http://blah.blah.blah.blah/ReportServer/")

Me.RV1.ServerReport.ReportPath = "/test/remailinvoice"

reportparams(0) = New Microsoft.Reporting.WinForms.ReportParameter("InvoiceNumber", _Invoice)

'note: _Invoice is a public property

Me.RV1.ServerReport.SetParameters(reportparams)

Me.RV1.ShowParameterPrompts = False

Me.RV1.RefreshReport()

and it works!

Thanks for your help.