Showing posts with label point. Show all posts
Showing posts with label point. Show all posts

Tuesday, March 20, 2012

check if a table exists in SQL 2005

I'm trying to check if a certain table exists in a given database on a SQL 2005 Server.

I've tried numerous times without any result.

can anyone point me in the right direction?

IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[TableName]') AND type in (N'U'))

This was generated when i create a drop script for table.

|||

the answer is so easy that i feel emberrased that i asked it.

Thanks for the support boban

|||Don't feel embarrased -I was googling for the answer and found it in this thread.

M@.
|||

when I try to use the script code it gives me an error that sys.objects doesnt exist am I missing something here?

|||

How about just 'select * from sys.objects where name = 'tablename' and type_desc = 'USER_TABLE'

Sunday, March 11, 2012

''check constraint'' ignored - PK violation

I thought the whole point of 'check constraint' being unticked meant you could whack your data straight in no probs.

How can I insert a bunch of historical information where I want to control the PK, in this case DealID?

I have got 'keep identity' checked.

I check the db, the Id does NOT exist currently.

Error: 0xC0202009 at Data Cleansing, Deal Insert [12194]: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x80004005.
An OLE DB record is available. Source: "Microsoft SQL Native Client" Hresult: 0x80004005 Description: "The statement has been terminated.".
An OLE DB record is available. Source: "Microsoft SQL Native Client" Hresult: 0x80004005 Description: "Violation of PRIMARY KEY constraint 'PK_DealID'. Cannot insert duplicate key in object 'dbo.Deal'.".If the DealId doesn't currently exist, make sure you don't have a duplicate value in the new (historical) data you're trying to load. The duplication is detected after the new data are loaded, so the duplication could exist within the new data as well as between the new data and the old.
|||The "Check Constraints" box only applies to CHECK and FOREIGN constraints.

Unique, Primary Key, and Not Null constraints are always enforced.

Fast Load is just a wrapper to BULK INSERT. See the CHECK_CONSTRAINTS flag here:

http://msdn2.microsoft.com/en-us/library/ms188365.aspx

Saturday, February 25, 2012

Charts

Is it possible to have charting in SQL Server REporting services, where when
a mouse points to a point on the graph, it displays the value of the point?Sorry, this is not supported. The closest you can get is to either use data
point labels which are always visible, or use drillthrough actions on chart
datapoints.
--
This posting is provided "AS IS" with no warranties, and confers no rights.
"TerminatorIII" <TerminatorIII@.discussions.microsoft.com> wrote in message
news:6015BBDE-C7F5-4A04-8F3D-F65B417F932C@.microsoft.com...
> Is it possible to have charting in SQL Server REporting services, where
> when
> a mouse points to a point on the graph, it displays the value of the
> point?

Charting...

I'll be quick and too the point...
1: I have a stacked area chart.
2: Percentages are the values being marked.
Issue:
I need to make the 100 mark (text and line) on the y-axis to be red.
I've tried writing an expression to get at the current "label" for the
mark. I keep getting the following error:
<<
The border color expression for the chart 'Sample' contains an
error: [BC30456] 'value' is not a member of
'ReportExprHostImpl.EH_Sample.EH_ValueAxis'.
>>
Here's what I have: '=iif(me.Value,"Black", "Red")'
I've also tried .Text and .Label.
Any help would be appreciated.I gave you incomplete code. Here is what I currently have.
Here's what I have: '=iif(me.Value <> "100","Black", "Red")'|||Sorry, the color of the axis is not an expression.
--
Brian Welcker
Group Program Manager
Microsoft SQL Server
This posting is provided "AS IS" with no warranties, and confers no rights.
"Stu" <stumiller@.unforgettable.com> wrote in message
news:1104275769.160878.21860@.z14g2000cwz.googlegroups.com...
>I gave you incomplete code. Here is what I currently have.
> Here's what I have: '=iif(me.Value <> "100","Black", "Red")'
>|||Brian Welcker [MS] wrote:
> Sorry, the color of the axis is not an expression.
> --
> Brian Welcker
> Group Program Manager
> Microsoft SQL Server
> This posting is provided "AS IS" with no warranties, and confers no
rights.
> "Stu" <stumiller@.unforgettable.com> wrote in message
> news:1104275769.160878.21860@.z14g2000cwz.googlegroups.com...
> >I gave you incomplete code. Here is what I currently have.
> > Here's what I have: '=iif(me.Value <> "100","Black", "Red")'
> >
Brian,
Thanks for responding...
So, just to make sure I understand what your saying... there is no way
to get the "value" or "text" of an axis and change the style of that
axis based upon that value?
The reason I "ask" it again this way is that I am able to change the
color of the line and text with this statement:
'=iif(InScope("100"),"Black", "Red")'
Ofcourse, "100" is not within the scope of the data and all the lines
turn "Red" but the point being, I can change the style in the
expression. I'm just asking is there a way to determine what axis your
on.
Thanks|||Yes, lines are data so you can set their color to an expression. Axis values
aren't data so expressions don't really make any sense (we can't iterate
through all possible values). We would have to add an 'Axis value color'
property to the data point.
--
Brian Welcker
Group Program Manager
Microsoft SQL Server
This posting is provided "AS IS" with no warranties, and confers no rights.
"Stu" <stumiller@.unforgettable.com> wrote in message
news:1104349698.883859.301160@.c13g2000cwb.googlegroups.com...
> Brian Welcker [MS] wrote:
>> Sorry, the color of the axis is not an expression.
>> --
>> Brian Welcker
>> Group Program Manager
>> Microsoft SQL Server
>> This posting is provided "AS IS" with no warranties, and confers no
> rights.
>> "Stu" <stumiller@.unforgettable.com> wrote in message
>> news:1104275769.160878.21860@.z14g2000cwz.googlegroups.com...
>> >I gave you incomplete code. Here is what I currently have.
>> > Here's what I have: '=iif(me.Value <> "100","Black", "Red")'
>> >
> Brian,
> Thanks for responding...
> So, just to make sure I understand what your saying... there is no way
> to get the "value" or "text" of an axis and change the style of that
> axis based upon that value?
> The reason I "ask" it again this way is that I am able to change the
> color of the line and text with this statement:
> '=iif(InScope("100"),"Black", "Red")'
> Ofcourse, "100" is not within the scope of the data and all the lines
> turn "Red" but the point being, I can change the style in the
> expression. I'm just asking is there a way to determine what axis your
> on.
> Thanks
>

Friday, February 24, 2012

Chart Series Total

I have a chart on one of my reports that has two series as a stracked bar
chart, and displays two point labels on each bar for the series value. What
I'd like to do is show the series value as a percentage relative to the total
bar value. The real problem here is I don't know how to get programmatically
get at the value shown in the point label, since this value calculated by
reporting services and not in my query (i.e. my query returns the total for
each bar, and SRS breaks it down into the two series values).
Any help would be appreciated.I haven't done many charts but can't you reference the label by
ReportItems!LabelName.Value.....I don't know if this is what you are looking
for.
"blabore" wrote:
> I have a chart on one of my reports that has two series as a stracked bar
> chart, and displays two point labels on each bar for the series value. What
> I'd like to do is show the series value as a percentage relative to the total
> bar value. The real problem here is I don't know how to get programmatically
> get at the value shown in the point label, since this value calculated by
> reporting services and not in my query (i.e. my query returns the total for
> each bar, and SRS breaks it down into the two series values).
> Any help would be appreciated.

Sunday, February 19, 2012

Chart color palate

Does anyone know a way to gain control of the color palate to the point of
picking your own colors and/or patterns? Also even using data driven colors?
ThanksLook at this link:
http://blogs.msdn.com/bwelcker/archive/2005/05/20/420349.aspx
"mrmac" wrote:
> Does anyone know a way to gain control of the color palate to the point of
> picking your own colors and/or patterns? Also even using data driven colors?
> Thanks|||Thank you alot.

Thursday, February 16, 2012

Chart - Point Labels inside the Bar

Hi People,

I'm with a new problem.

I creted a simple bar type and sometimes the values of point labels are showing inside of bar, This is a problema, because if the length of bar will be short, the value doesn't shows. How can I make to force the point label value outside of bar ?

Thanks

it has a legend loc on the data field properties.

you can change the location by choosing from the 9 blocks.

Chart - Point Labels inside the Bar

Hi People,

I'm with a new problem.

I creted a simple bar type and sometimes the values of point labels are showing inside of bar, This is a problema, because if the length of bar will be short, the value doesn't shows. How can I make to force the point label value outside of bar ?

Thanks

it has a legend loc on the data field properties.

you can change the location by choosing from the 9 blocks.

Sunday, February 12, 2012

char or varchar?

Is it better to set a column type to char(x) or varchar(x), from the indexes
point of view? Which is faster?
Also which is more convinient when comparing strings (do i have to right
trim char(x) columns before comparing)?It depends on your requirements. SQL Server stores the data for these
datatypes diffrerently
1) VARCHAR(n)
SQL Server stores 1 byte per character.Declared but unused charcters do not
consume storage
2) CHAR(n)
SQL Server stores 1byte per charcter n declared ,event if partialy unused
"Savvoulidis Iordanis" <iordanis_sav@.hotmail.com> wrote in message
news:OF%23DNEVOHHA.4244@.TK2MSFTNGP04.phx.gbl...
> Is it better to set a column type to char(x) or varchar(x), from the
> indexes point of view? Which is faster?
> Also which is more convinient when comparing strings (do i have to right
> trim char(x) columns before comparing)?
>
>|||On Tue, 16 Jan 2007 08:05:56 +0200, "Savvoulidis Iordanis"
<iordanis_sav@.hotmail.com> wrote:
>Is it better to set a column type to char(x) or varchar(x), from the indexes
>point of view? Which is faster?
>Also which is more convinient when comparing strings (do i have to right
>trim char(x) columns before comparing)?
It depends. 8-)
On the one hand, a varying length column takes more processing than a
fixed length column. I seem to remember hearing that this is
especially true when they are used in an index.
On the other hand, a varchar column MAY, depending on the size of the
actual data compared to the declared size, save a lot of space. And
wasting space means the index takes up more space, which is to say
more pages. More pages means more I/O, and consuming more space in
the cache - or fitting fewer pages in the cache.
(Keep in mind that varchar has a two-byte overhead that char lacks. So
a varchar(5) column uses up 2 to 7 bytes of storage.)
There are some clear-cut cases. A column that averages 6 characters
of data would be better as a varchar(30) than as a char(30), even if
used in an index. But a column that averages 6 characters of data
would probably be better as a char(10) than a varchar(10 for indexing.
Sorry, I don't have a magic number to tell you when the balance tips
from one to the other.
Roy Harvey
Beacon Falls, CT|||As well as Uri's and Roy's comments, you might want to consider the
update/insert ratio as another factor n deciding which datatype to use. If
there are a lot of updates you might potentially end up with many forwarding
pointers if there isn't enough space to expand the varchar column's data
in-place, so in such circumstances varchar may become slower than char
access. Running DBCC SHOWCONTIG and supplying the option WITH TABLERESULTS
will give you an indication if this is an issue for you.
Cheers,
Paul Ibison SQL Server MVP, www.replicationanswers.com .