Showing posts with label value. Show all posts
Showing posts with label value. Show all posts

Friday, March 30, 2012

Long text in "Default value or Binding"

Hey guys, how can I use a long text as default value in my database (column properties)?
I tried to paste my 10 row text into the field but it will only paste the first row as default value.

any ideas??What's the data type and data length of the column to which you paste text? And where did you paste your 10 row text into database?|||data type: text

It's obviosuly working fine if I create an update command updating the database with the same text. All I want is to have this text as default value for the column. But only the first row will be pasted...

SQL Server Mgmt-studio - Column Properties - default value or binding. Just a lil frustrating :)|||

OK now I understand youSmile Unfortunately this seems to be a flaw of Management Studio GUI, while you can add multiple lines as default in Enterprise Manager in SQL2000Surprise However we can define multiple-line default value by using T-SQL. New a query and use such statement:

ALTER TABLE dbo.test2 ADD CONSTRAINT
DF_Table1_description DEFAULT'The general steps are:

Back up the source database, which can reside on an instance of SQL Server 7.0, SQL Server 2000, or SQL Server 2005. The computer on which this instance of SQL Server is running is the source computer.

.'FOR description

sql

Long text column not accepting

Hi DBAs,
I am very new in SQL server. I created a table where one column is varchar(8000). But when I am trying to insert value from enterprise manager this column cann't accept a long text value. I counted that its' capacity is 1012 charecters. I have tried a lot but don't know how to solve this. I really need help from you. Pls help.

Thanks in advance

Rajat RaychaudhuriI am under pressure , pls advice me soon|||Use Query Analyzer.|||Have you tried using INSERT statement from QA? What's the total length of your record?|||Thanx friends. From Query Analyzer it worked.
Rajat|||If you are new to this, one quick note. SQL Server's Row Byte size is limited somewhere right around 8k bytes for physical data stored in the database. So, if the table has other columns in it, you might be in for trouble. Switching a very large column to Text may save you some future hassle. Of course, it could cause you a little hassle right now. :)|||I respect people that appreciate the value of TEXT/IMAGE datatypes ;)|||A little hassle now? That's not near as much hassle as it could cause him down the road.

RANT OFF

Go ahead...your turn now.|||TEXT/NTEXT/IMAGE columns definitely have their place. They can do things that are otherwise impossible in SQL Server. I don't see them as substitutes for VARCHAR or NVARCHAR any more than I see DATETIME as a substitute... Under certain rigorous conditions any of them might work, but as a generic substitute they are poor choices.

-PatP|||Switching a very large column to Text


-----------
http://www.3-ibm.com|||Is this a question? And how large is "very large"?|||I think he means it's veeeeeeeeeeeeeeeery large.

Long text

Hi,
I have written a UDF that calls itself and nests its operation. The output
is a varchar value in XML format. But sometimes the XML is more than 8000
characters and varchar is small for that. It is not possible to use text
data type. What can I do?
Any help would be greatly appreciated,
LeilaCan you form the XML using FOR XML instead of your own recursive UDF?
--
Adam Machanic
SQL Server MVP
http://www.sqljunkies.com/weblog/amachanic
--
"Leila" <leilas@.hotpop.com> wrote in message
news:%23XJncCx5EHA.2624@.TK2MSFTNGP11.phx.gbl...
> Hi,
> I have written a UDF that calls itself and nests its operation. The output
> is a varchar value in XML format. But sometimes the XML is more than 8000
> characters and varchar is small for that. It is not possible to use text
> data type. What can I do?
> Any help would be greatly appreciated,
> Leila
>|||Actually I tried, maybe it's because lack of my skills in writing queries
that I couldn't use FOR XML, hence used UDF. Could you please have a look to
my post with subject: Retrieving Data in XML Format
Thanks
"Adam Machanic" <amachanic@.hotmail._removetoemail_.com> wrote in message
news:us1MORx5EHA.2316@.TK2MSFTNGP15.phx.gbl...
> Can you form the XML using FOR XML instead of your own recursive UDF?
> --
> Adam Machanic
> SQL Server MVP
> http://www.sqljunkies.com/weblog/amachanic
> --
>
> "Leila" <leilas@.hotpop.com> wrote in message
> news:%23XJncCx5EHA.2624@.TK2MSFTNGP11.phx.gbl...
>> Hi,
>> I have written a UDF that calls itself and nests its operation. The
>> output
>> is a varchar value in XML format. But sometimes the XML is more than 8000
>> characters and varchar is small for that. It is not possible to use text
>> data type. What can I do?
>> Any help would be greatly appreciated,
>> Leila
>>
>|||Start reading:
www.sqlxml.org
Adam Machanic
SQL Server MVP
http://www.sqljunkies.com/weblog/amachanic
--
"Leila" <leilas@.hotpop.com> wrote in message
news:uNJZHFy5EHA.3472@.TK2MSFTNGP09.phx.gbl...
> Actually I tried, maybe it's because lack of my skills in writing queries
> that I couldn't use FOR XML, hence used UDF. Could you please have a look
to
> my post with subject: Retrieving Data in XML Format
> Thanks
>
>
> "Adam Machanic" <amachanic@.hotmail._removetoemail_.com> wrote in message
> news:us1MORx5EHA.2316@.TK2MSFTNGP15.phx.gbl...
> > Can you form the XML using FOR XML instead of your own recursive UDF?
> >
> > --
> > Adam Machanic
> > SQL Server MVP
> > http://www.sqljunkies.com/weblog/amachanic
> > --
> >
> >
> > "Leila" <leilas@.hotpop.com> wrote in message
> > news:%23XJncCx5EHA.2624@.TK2MSFTNGP11.phx.gbl...
> >> Hi,
> >> I have written a UDF that calls itself and nests its operation. The
> >> output
> >> is a varchar value in XML format. But sometimes the XML is more than
8000
> >> characters and varchar is small for that. It is not possible to use
text
> >> data type. What can I do?
> >> Any help would be greatly appreciated,
> >> Leila
> >>
> >>
> >
> >
>

Long text

Hi,
I have written a UDF that calls itself and nests its operation. The output
is a varchar value in XML format. But sometimes the XML is more than 8000
characters and varchar is small for that. It is not possible to use text
data type. What can I do?
Any help would be greatly appreciated,
Leila
Can you form the XML using FOR XML instead of your own recursive UDF?
Adam Machanic
SQL Server MVP
http://www.sqljunkies.com/weblog/amachanic
"Leila" <leilas@.hotpop.com> wrote in message
news:%23XJncCx5EHA.2624@.TK2MSFTNGP11.phx.gbl...
> Hi,
> I have written a UDF that calls itself and nests its operation. The output
> is a varchar value in XML format. But sometimes the XML is more than 8000
> characters and varchar is small for that. It is not possible to use text
> data type. What can I do?
> Any help would be greatly appreciated,
> Leila
>
|||Actually I tried, maybe it's because lack of my skills in writing queries
that I couldn't use FOR XML, hence used UDF. Could you please have a look to
my post with subject: Retrieving Data in XML Format
Thanks
"Adam Machanic" <amachanic@.hotmail._removetoemail_.com> wrote in message
news:us1MORx5EHA.2316@.TK2MSFTNGP15.phx.gbl...
> Can you form the XML using FOR XML instead of your own recursive UDF?
> --
> Adam Machanic
> SQL Server MVP
> http://www.sqljunkies.com/weblog/amachanic
> --
>
> "Leila" <leilas@.hotpop.com> wrote in message
> news:%23XJncCx5EHA.2624@.TK2MSFTNGP11.phx.gbl...
>
|||Start reading:
www.sqlxml.org
Adam Machanic
SQL Server MVP
http://www.sqljunkies.com/weblog/amachanic
"Leila" <leilas@.hotpop.com> wrote in message
news:uNJZHFy5EHA.3472@.TK2MSFTNGP09.phx.gbl...
> Actually I tried, maybe it's because lack of my skills in writing queries
> that I couldn't use FOR XML, hence used UDF. Could you please have a look
to[vbcol=seagreen]
> my post with subject: Retrieving Data in XML Format
> Thanks
>
>
> "Adam Machanic" <amachanic@.hotmail._removetoemail_.com> wrote in message
> news:us1MORx5EHA.2316@.TK2MSFTNGP15.phx.gbl...
8000[vbcol=seagreen]
text
>

Monday, March 26, 2012

Long Label Expression

I have a long expression that returns the value of my one label. The expression is suppose to figure out if there are three parts to the MailAddress field and return the appriopriate number of fields properly formated. The format I need to get returned from this delimited field looks like

PersonIdNumber

CO Line

Name Here

123 Address Street

City State Zip Country

Each line is followed by a semicolon which I have coded to each be replaced by a newline. The main problem is that sometimes we have a CO Line and sometimes we don't. There will be a delimeter right before the AddressStreet Line even if the CO Line does not exist, so that shouldn't be a problem.

Also, the Name Here line is not returned from my delimited MailAddress field, it is a seperate field. For some reason the label returns an error in the report. I'm assuming it is it is in the code below. If you see something wrong with the expression please let me know.


Code Snippet

=IIF(Count(Split(Fields!MailingAddress.Value, ";")) = 3, (LTrim(Replace(Replace(Choose(1, Split(Fields!MailingAddress.Value, ",")),",", " "), ";", " "))& vbcrlf & Fields!Name.Value & vbcrlf & LTrim(Choose(2, Split(Replace(Replace(Fields!MailingAddress.Value, ";", vbcrlf), ",", " "), vbcrlf)))& vbcrlf & LTrim(Choose(3, Split(Replace(Replace(Fields!MailingAddress.Value, ";", vbcrlf), ",", " "), vbcrlf)))), (Fields!Name.Value & vbcrlf & LTrim(Choose(1, Split(Replace(Replace(Fields!MailingAddress.Value, ";", vbcrlf), ",", " "), vbcrlf)))& vbcrlf & LTrim(Choose(2, Split(Replace(Replace(Fields!MailingAddress.Value, ";", vbcrlf), ",", " "), vbcrlf)))))

I'm currently using SSRS 2005...

Hello,

What's the error you're getting when you add the Name field to the expression?

Jarret

|||

The error that is returned is for the entire expression (Name field included). The error just looks like your usual label error :

#Error

|||

Hello,

If you open the Output window (Ctrl+Alt+O), you should see the actual error message you are getting.

Jarret

|||

It is the rsRuntimeErrorinExpression:

The Value expression for the textbox ‘textbox1’ contains an error: Operation is not valid due to the current state of the object.

Preview complete -- 0 errors, 1 warnings

|||

Here is a couple of examples of the MailAddress field coming straight from our database:

With CO Line...

RE: 2423 N. First St.;,9838 Witicki Road;,Sandsburg,Ohio,23911;

Without CO Line..

;,9838 Witicki Road;,Sandsburg,Ohio,23911;

Hope this helps!

|||

Hello,

The problem was with the Count function call, you can't use it on an array. From your data examples, it looks like you will always have 3 semi-colons to seperate your data (whether or not it has data for that section).

Try this:

Code Snippet

=LTrim(Replace(Switch(Len(Split(Fields!MailingAddress.Value, ";")(0)) > 0, Split(Fields!MailingAddress.Value, ";")(0) & vbCrLf), ",", " "))

& Fields!Name.Value

& vbCrLf & LTrim(Replace(Split(Fields!MailingAddress.Value, ";")(1), ",", " "))

& vbCrLf & LTrim(Replace(Split(Fields!MailingAddress.Value, ";")(2), ",", " "))

Hope this helps.

Jarret

|||

Thanks for the quick replies! I tried this and it works with the CO Line, but not without. It chooses the address line to go above the Name field instead of nothing. It looked like this:

9838 Witicki Road

Dan Ricksworth

Sandsburg Ohio 23911

Instead of looking like:

Dan Ricksworth

9838 Witicki Road

Sandsburg Ohio 23911

I have decided to edit our database's MailAddress function that collects and adds the delimeters. I'm going to add the Name field into it and then just use the replace function to add the newlines. Hopefully this will work.

|||

I'm a little confused, I used the example data you supplied and got this as the result:

Mailing Address Name Result RE: 2423 N. First St.;,9838 Witicki Road;,Sandsburg,Ohio,23911; Bob Ricksworth RE: 2423 N. First St.
Bob Ricksworth
9838 Witicki Road
Sandsburg Ohio 23911 ;,9838 Witicki Road;,Sandsburg,Ohio,23911; Dan Ricksworth Dan Ricksworth
9838 Witicki Road
Sandsburg Ohio 23911

Is this not the correct format? If the first section of the MailingAddress has a value, then the name is listed 2nd, otherwise, the name is listed first. In the above table, the first row has the CO Line (marked in red), and the second row does not have a CO Line.

This is the expression I used:

Code Snippet

=LTrim(Replace(Switch(Len(Split(Fields!MailingAddress.Value, ";")(0)) > 0, Split(Fields!MailingAddress.Value, ";")(0) & vbCrLf), ",", " "))
& Fields!Name.Value
& vbCrLf & LTrim(Replace(Split(Fields!MailingAddress.Value, ";")(1), ",", " "))
& vbCrLf & LTrim(Replace(Split(Fields!MailingAddress.Value, ";")(2), ",", " "))

Jarret

|||Thats weird... I copied and pasted your expression directly into my label and it gave me the wrong format. It probably is my fault. I'm assuming that somewhere I missed a delimeter (either comma or semi-colon) and gave you incorrect data from MailingAddress. Your expression looks right. I'll give you the solution. At this point I have already added the Name field to the MailingAddress field and have got the correct format. It would be too time consuming to go back and test to figure out where I went wrong. Thanks for the help though!|||

Yes, that is weird that it showed differently. Oh well, glad to help!

Jarret

Friday, March 9, 2012

Login.Language property for sa is not set.

I installed SQL 2000 standard edition.

Then I called server.Logins["sa"].Language

For some reason the value of this property was "" (empty string).

Can anyone explain, why?

P.S. After changing Default language for 'sa' login through Management Studio Language property became accessible..

Alexander Sychev.

The language property is tied to the property set in SQL for the login. By default it is just <default> and that is an empty string. When you set it like you did, the property is explicitly set.

Login.Language property for sa is not set.

I installed SQL 2000 standard edition.

Then I called server.Logins["sa"].Language

For some reason the value of this property was "" (empty string).

Can anyone explain, why?

P.S. After changing Default language for 'sa' login through Management Studio Language property became accessible..

Alexander Sychev.

The language property is tied to the property set in SQL for the login. By default it is just <default> and that is an empty string. When you set it like you did, the property is explicitly set.