Showing posts with label allows. Show all posts
Showing posts with label allows. Show all posts

Wednesday, March 7, 2012

ALTER COLUMN?

I want to change a column in a table. The data type is int, and it allows
NULLs. I want to make it non-nullable and give it a DEFAULT value of 0. I've
looked up ALTER TABLE in BOL but I don't seem to see what the syntax is to
accomplish this. Is it even possible? TIA!You can do someting like this
CREATE TABLE TESTDEFAULTS (
ID INT)
INSERT INTO TESTDEFAULTS
VALUES (1)
SELECT *
FROM TESTDEFAULTS
ALTER TABLE TESTDEFAULTS ALTER COLUMN ID INT NOT NULL
ALTER TABLE TestDefaultS ADD CONSTRAINT IDNotNull DEFAULT (0) FOR [ID]
INSERT INTO TESTDEFAULTS
DEFAULT VALUES
SELECT *
FROM TESTDEFAULTS
--This will give an error now
INSERT INTO TestDefaultS VALUES (NULL)
DROP TABLE TESTDEFAULTS
Denis the SQL Menace
http://sqlservercode.blogspot.com/|||Thanks! At first I got an error but once I UPDATEd the column to 0 WHERE it
IS NULL, voila! Again, thank you!
"SQL" <denis.gobo@.gmail.com> wrote in message
news:1147462107.839063.66230@.d71g2000cwd.googlegroups.com...
> You can do someting like this
> CREATE TABLE TESTDEFAULTS (
> ID INT)
> INSERT INTO TESTDEFAULTS
> VALUES (1)
> SELECT *
> FROM TESTDEFAULTS
> ALTER TABLE TESTDEFAULTS ALTER COLUMN ID INT NOT NULL
> ALTER TABLE TestDefaultS ADD CONSTRAINT IDNotNull DEFAULT (0) FOR [ID]
> INSERT INTO TESTDEFAULTS
> DEFAULT VALUES
>
> SELECT *
> FROM TESTDEFAULTS
> --This will give an error now
> INSERT INTO TestDefaultS VALUES (NULL)
> DROP TABLE TESTDEFAULTS
>
> Denis the SQL Menace
> http://sqlservercode.blogspot.com/
>

Friday, February 24, 2012

allows blank value for integer Parameter

Hi have a problem to solve and I hope that this is not a SSRS Bug.

I created a Reports(using SQL Server Project) which has several parameters which values are passed to a SP.

One of these parameter is an Integer and it is an optional value, so if the user fill it is used by the SP, otherwise the SP uses NULL and run anyway.

I starts to define tha parameter:

Datatype = integer

Allow blank value

Available: Non queried

Default: Null

if I want to Preview the report I have to provide an integer to the parameter's field ...

If for instance I set:

Default: Not queried = 0

In the moment I deploy and I use the ReportViewer in my window application the parameter's field is unabled!!

So I tried this solution:

Datatype = integer

Allow blank value

Allow null value

Available: Non queried

Default: Null

In the preview the checkbox: NULL is checked and I click on the View Report.

But when I deploy it,in the ReportViewer in my window application the parameter's field this checkbox is unchecked.

Do I forget something during my setting?I have to control it programmatically?

N.B. By default the user will not user this parameter so the best is that he can click directly on "View Report" without any additional "work" on the parameter!!

Thank you for any help!

hi,

On the report parameters form do this please:

Add a parameter, name it to something,

choose data type integer,

mask as checked the "Allow null value",

select null as default value.

It was working on that way on my box as you wished. I'm using SSRS 2005 wih SP2

Regards,

Janos

Sunday, February 19, 2012

Allowing multi-element user defined custom data

We are creating a phonebook application which allows users to add custom
data to each entry, in the form of a (name):(value) pair. The users should
be able to add names of custom data types to a look-up table, and then be
able to add data values of that "type" to any entry in the phonebook. The
data will be saved as nvarchar.
However, we now realize some of this custom data will have to be made up
of several data elements in itself. For example: If the users want to add
the data type "address at in-law's", this custom data will be more than just
(name):(long string value), it will have to be (name):((street)(city)(state)(zipcode)).
We have several ideas on how to do this but they all seem cumbersome, and
they complicate the design a lot. Has anyone created a system like this before?
Is there a tried and true way of doing this?Hi
Have you thought of using XML for this?
John
"Ido Kalir" wrote:
> We are creating a phonebook application which allows users to add custom
> data to each entry, in the form of a (name):(value) pair. The users should
> be able to add names of custom data types to a look-up table, and then be
> able to add data values of that "type" to any entry in the phonebook. The
> data will be saved as nvarchar.
> However, we now realize some of this custom data will have to be made up
> of several data elements in itself. For example: If the users want to add
> the data type "address at in-law's", this custom data will be more than just
> (name):(long string value), it will have to be (name):((street)(city)(state)(zipcode)).
> We have several ideas on how to do this but they all seem cumbersome, and
> they complicate the design a lot. Has anyone created a system like this before?
> Is there a tried and true way of doing this?
>

Thursday, February 16, 2012

Allow null value in multi-value parameter

Hello,

I have a multi-value parameter field and each item comes from a table in the DB.

This multi-value parameter allows to select all or some of the items.

What if I don't want to select ANY item?

I read in the forum the several tray to do the same but the answers are not so clear..

If I say that at the end is a bug in SSRS... AM I right?

Thank you

Marina B.

I do this all the time. THe difference between what you have read and tried and what I am doing is that I am constructing the query as a string, not trying to pass the parameter values to a sproc or anything.

If you are interested in doing it this way, I think I wrote some instructions in other threads... try this one http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1705421&SiteID=1

As to whether it is a "bug in SSRS", I'm not sure why you think that but I'm sure other people will be happy to debate it with you <g>.

>L<