Showing posts with label parts. Show all posts
Showing posts with label parts. Show all posts

Monday, March 19, 2012

help with a max length table constraint

Table File_Paths (physical system file paths)

The columns represent parts of the path.

How can I set up a constraint that the total concatenated length of all the columns within a row is less than 260 chars?

Thanks

ALTER TABLE SomeTable WITH NOCHECK
ADD CONSTRAINT SomeCheck CHECK (LEN(Col1+ co2 + col 3) <= 260)

HTH, Jens Suessmeyer.

|||

Right on target. Thanks

For some reason, when it gets saved a bunch of unnecessary parentheses both square and round get added.

The square brackets help if there are white spaces but the program just forces them. Likewise with the round the len() function did not need the items enclosed individually either.

Is there wa way to turn that off in SSMS?

|||The database engine modifies expressions specified in constraints, defaults, computed column etc. There is no way to control this behavior or suppress it. This is even more so in SQL Server 2005. So you should not rely on the scripting for your DDL. Instead it is better to maintain the scripts yourself in source code control system.|||

Thanks.

A newbie needs hand holding and the GUI does that. I am sure eventually I will get more independent but until then...

Umachandar Jayachandran - MS wrote:

you should not rely on the scripting for your DDL. Instead it is better to maintain the scripts yourself in source code control system.

Let me get this straight:

After I execute the script, the only other time I need it is if I want to modify it or reuse it on another server. Otherwise, it is for informational purposes. For the info to be effective, the DDL code would have to be broken down into smaller files for granularity and a huge effort to duplicate the tree-like organization. No automation at all. And all this while the same already exists, but the code is munged.

What is it with MS and code munging by force? Didn't they get enough complaints about mutilating html/aspnet markup in VS1.x? That was a sheer nightmare!

What good does it do to add over 40 unnecessary bracket chars in just one line of code?

</rant>

Friday, February 24, 2012

Help select data type

Hi Everyone,

I have a table in my database that stores info to process a 'Parts Rush' request, so a user can get there part expedited. I want to have a field in my table named 'Status'.

The four status' are:

Pending

Approved

Declined

Coachback

The question is should I use integers to represent the status (ie. 1 = Pending) or should I set that field to varchar and store the actual word?

I'm just trying to develop my SQL skills and what to exercise good practices. I am using SQL Server 2005 Express.

Thank You

-Sam

I recommend setting the status field to an int, and having a separate table linking the ints to the status strings - sure you'll have to join, but I believe it's a better practice than flat-out throwing a string in the main table.|||

I agree with making it an integer type over a varchar. In addition, you might want to consider making it either a TINYINT or a SMALLINT to save space if you know that you will never have 255 different specific statuses for TINYINT or 32767 different status for SMALLINT. Use of either of these datatypes will save you some space and over the long pull might slightly improve IO performance.

However, you also need to weigh some compatibility factors. The INTEGER datatype is certainly more universally available in other DBMS implementations. You may not want to use TINYINT or SMALLINT to avoid a few cross-platform issues. I think the more universal type would be the INT type.

Sunday, February 19, 2012

Help required fro Reporting service webparts

Hi,
Since this is related to sharepoint reporting service web parts, I am
posting in both.
In place of report explorer I need to create my custom explorer. I have
figured out that report explorer implements ICellProvider.
I tried using it in my custom Report explorer, but unfortunately the URL
I am trying to pass is creating problems.
I can see the "report manager" in report viewer web part if my custom
explorer provides the cell data in following form:
"http://server/ReportS?/Users+Folders/domain+user/My
Reports/ChangeManagement/Matrix&rs:Command=Renderrc:Area=Report"
I would appreciate if any one can point out what data (and its format)
Report viewer web part expect as connection parameter.
Thanks
AmitAmit,
Are you using the MS webparts which just has the Viewer and the
explorer?
If so I have some third party web parts that do the parameters etc
which may be an easier solution to your problem.
Kind Regards
Dan Orchard
dan.orchard@.idow.co.uk
Amit Saxena wrote:
> Hi,
> Since this is related to sharepoint reporting service web parts, I am
> posting in both.
> In place of report explorer I need to create my custom explorer. I
> have figured out that report explorer implements ICellProvider. I
> tried using it in my custom Report explorer, but unfortunately the
> URL I am trying to pass is creating problems.
> I can see the "report manager" in report viewer web part if my custom
> explorer provides the cell data in following form:
> "http://server/ReportS?/Users+Folders/domain+user/My
> Reports/ChangeManagement/Matrix&rs:Command=Renderrc:Area=Report"
>
> I would appreciate if any one can point out what data (and its
> format) Report viewer web part expect as connection parameter.
>
> Thanks
> Amit|||Hi Dan,
I am using MS webparts. I will appreciate if you can tell me about other
webparts too.
Amit
Dan Orchard wrote:
> Amit,
> Are you using the MS webparts which just has the Viewer and the
> explorer?
> If so I have some third party web parts that do the parameters etc
> which may be an easier solution to your problem.
> Kind Regards
> Dan Orchard
> dan.orchard@.idow.co.uk
>
> Amit Saxena wrote:
>
>>Hi,
>>Since this is related to sharepoint reporting service web parts, I am
>>posting in both.
>>In place of report explorer I need to create my custom explorer. I
>>have figured out that report explorer implements ICellProvider. I
>>tried using it in my custom Report explorer, but unfortunately the
>>URL I am trying to pass is creating problems.
>>I can see the "report manager" in report viewer web part if my custom
>>explorer provides the cell data in following form:
>>"http://server/ReportS?/Users+Folders/domain+user/My
>>Reports/ChangeManagement/Matrix&rs:Command=Renderrc:Area=Report"
>>
>>I would appreciate if any one can point out what data (and its
>>format) Report viewer web part expect as connection parameter.
>>
>>Thanks
>>Amit
>