Thursday, March 29, 2012
create an Indexes/Keys Property with T-SQL
thanxYes. CREATE INDEX.
-PatP|||Yes. CREATE INDEX.
-PatP
excuse me while I climb back on my barstool...um office chair...
LNHockey...seriously though... alittle more background on what you're trying to do...
"create index"....why I outta.....|||Yes ok..excuse me.
i do this
<b>
ALTER TABLE TblSalle ADD [IdTypeTaxe] [int] NOT NULL default(0)<br>
CREATE INDEX PK_TblSalle ON TblSalle (IdTypeTaxe)</b>
and would like to assign is "Selected index value" to IX_IdTypeTaxe that i userly have in a combobox when i use the sql manager
but i want to do it in a store proc..
or how can i modify that value after i add the new column to my table|||Yup...I'm lost..
Huh?|||You know when you go to design mode of the table and go properties of the selected column and select the tab "Indexes/keys". under that you can switch the type "Primary key to Index" ?? !!!
just wondering if we can do the same thing in a Store proc using a function kind of thing
thanx !
Create an data type with identity(1, 1) property
Code Snippet
--I'm trying this command:
create type int8 from tinyint identity(1,1) not null
But, an error occurs: don't possible create an data type with identity property....... Correct?
How to create an data type with identity property? The 'sys.sp_addextendedproperty' SP is the solution? An example, please?
Bye!
The IDENTITY property is linked to a table -as well as a datatype.
CREATE TABLE MyTable
( RowID int IDENTITY,
MyDate varchar(20)
)
You cannot simply CREATE TYPE or DECLARE a variable and also have an IDENTITY property for the type/variable.
|||another example?execute('
select
identity(int,1,1) as id,
sum(trunk.count) as count,
sum(trunk.duration) as duration,
sum(trunk.charge1) as charge1,
trunk.trunk,
trunk.currency
into
#utilisation
from
(
select
count(local.callid) as count,
sum(local.duration) as duration,
sum(isnull(local.charge1,''0'')) as charge1,
local.trunk,
local.currency
from
tt32.dbo.trunk t,
database.dbo.local01 local
where
local.trunk = t.trunk
group by
local.trunk,
local.currency
)trunk
group by
trunk.trunk,
trunk.currency
--showing the result
select
id,
isnull(count,''0'') as count,
duration,
isnull(charge1,''0'') as charge1,
trunk,
currency
from #utilisation
|||: (
Ok. Thanks!
Bye!
Monday, March 19, 2012
CR10 web viewer width 100%
I'm trying to set my CrystalReportViewer to 100% of page width in ASP.NET. When I set the Width property on the control in the ASPX page itself, the viewer renders itself correctly when the page first loads, but on each postback the "%" is changed to "px" causing the viewer to be only 100 pixels wide.
I can apparently get around that by setting the width to Unit.Percentage(100) on every Page_Load event. Then the viewer appears as I expect with 100% width everytime I navigate pages, search, or export.
My problem is this workaround doesn't seem to work for the group tree. When I toggle the group tree, the two divs that get rendered are of width 14px and 86px (which add up to 100px).
Any ideas how I can get around this bug?
Thanks,
JamesI have a lousy solution but it seems to work (this is C# code but same should apply to VB):
public class MyCrystalReportViewer : CrystalDecisions.Web.CrystalReportViewer
{
protected override void Render(HtmlTextWriter output)
{
string renderedControl = string.Empty;
// Render the control to a string builder
StringBuilder sb = new StringBuilder();
StringWriter sw = new StringWriter(sb);
HtmlTextWriter htw = new HtmlTextWriter(sw);
base.Render(htw);
// Extract the string for processing
renderedControl = sb.ToString();
// Replace certain strings in the group tree div style tag
// Be sure to check for all indices along the way and just do nothing if things aren't found.
int groupTreeIndex = renderedControl.IndexOf("<div class=\"crgrptr\"");
if ( groupTreeIndex != -1 )
{
int groupTreeStyle = renderedControl.IndexOf("style=\"",groupTreeIndex);
if ( groupTreeStyle != -1 )
{
int groupTreeStyleEnd = renderedControl.IndexOf("\"",groupTreeStyle+7);
if ( groupTreeStyleEnd != -1 )
{
string groupTreeStyleTag = renderedControl.Substring(groupTreeStyle+7,groupTreeStyleEnd-groupTreeStyle-7);
renderedControl = renderedControl.Substring(0,groupTreeStyle+7)
+ "display:inline;" + groupTreeStyleTag.Replace("width:14px","width:14%").Replace("position:absolute","position:static")
+ renderedControl.Substring(groupTreeStyleEnd);
}
}
}
// Replace certain strings in the page div style tag
// Be sure to check for all indices along the way and just do nothing if things aren't found.
int pageIndex = renderedControl.IndexOf("<div class=\"crystalstyle\"");
if ( pageIndex != -1 )
{
int pageStyle = renderedControl.IndexOf("style=\"",pageIndex);
if ( pageStyle != -1 )
{
int pageStyleEnd = renderedControl.IndexOf("\"",pageStyle+7);
if ( pageStyleEnd != -1 )
{
string pageStyleTag = renderedControl.Substring(pageStyle+7,pageStyleEnd-pageStyle-7);
renderedControl = renderedControl.Substring(0,pageStyle+7)
+ "display:inline;" + pageStyleTag.Replace("width:86px","width:86%").Replace("position:absolute","position:static")
+ renderedControl.Substring(pageStyleEnd);
}
}
}
// Now output the reformatted HTML of the control
output.Write(renderedControl);
}
}
Sunday, February 19, 2012
Counting rows from Flat File Source
Hello,
Is there a way (perhaps a property) to capture the number of rows selected from a Flat File Data Flow Source without having to develop a script to loop through the rows and count them?
Thanks a lot,
Grace
Yep. Use the ROWCOUNT component.
Row Count Transformation
(http://wiki.sqlis.com/default.aspx/SQLISWiki/Row%20Count%20Transformation.html)
-Jamie