I need to upgrade a column of a table in a script but I would like to check
if the column type is correct first and if so not process the alter table
script
alter table EventVenueTransaction alter column RowGUID uniqueidentifier NOT
NULL
GO
Is there a way I can do this.
Regards
Jeff
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.698 / Virus Database: 455 - Release Date: 2/06/2004
You can use the following statement to test for the correct datatype but if
you just want to alter it anyway then there is no need to do the test first.
If the ALTER TABLE statement doesn't change the properties of the column
then it will have no effect anyway.
IF
(SELECT data_type
FROM information_schema.columns
WHERE table_name = 'EventVenueTransaction'
AND column_name = 'rowguid')
<> 'uniqueidentifier'
...
David Portas
SQL Server MVP
Showing posts with label upgrade. Show all posts
Showing posts with label upgrade. Show all posts
Tuesday, March 20, 2012
Check if Column is property type before Alter Statement
I need to upgrade a column of a table in a script but I would like to check
if the column type is correct first and if so not process the alter table
script
alter table EventVenueTransaction alter column RowGUID uniqueidentifier NOT
NULL
GO
Is there a way I can do this.
Regards
Jeff
--
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.698 / Virus Database: 455 - Release Date: 2/06/2004You can use the following statement to test for the correct datatype but if
you just want to alter it anyway then there is no need to do the test first.
If the ALTER TABLE statement doesn't change the properties of the column
then it will have no effect anyway.
IF
(SELECT data_type
FROM information_schema.columns
WHERE table_name = 'EventVenueTransaction'
AND column_name = 'rowguid')
<> 'uniqueidentifier'
...
--
David Portas
SQL Server MVP
--
if the column type is correct first and if so not process the alter table
script
alter table EventVenueTransaction alter column RowGUID uniqueidentifier NOT
NULL
GO
Is there a way I can do this.
Regards
Jeff
--
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.698 / Virus Database: 455 - Release Date: 2/06/2004You can use the following statement to test for the correct datatype but if
you just want to alter it anyway then there is no need to do the test first.
If the ALTER TABLE statement doesn't change the properties of the column
then it will have no effect anyway.
IF
(SELECT data_type
FROM information_schema.columns
WHERE table_name = 'EventVenueTransaction'
AND column_name = 'rowguid')
<> 'uniqueidentifier'
...
--
David Portas
SQL Server MVP
--
Check if Column is property type before Alter Statement
I need to upgrade a column of a table in a script but I would like to check
if the column type is correct first and if so not process the alter table
script
alter table EventVenueTransaction alter column RowGUID uniqueidentifier NOT
NULL
GO
Is there a way I can do this.
Regards
Jeff
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.698 / Virus Database: 455 - Release Date: 2/06/2004You can use the following statement to test for the correct datatype but if
you just want to alter it anyway then there is no need to do the test first.
If the ALTER TABLE statement doesn't change the properties of the column
then it will have no effect anyway.
IF
(SELECT data_type
FROM information_schema.columns
WHERE table_name = 'EventVenueTransaction'
AND column_name = 'rowguid')
<> 'uniqueidentifier'
..
David Portas
SQL Server MVP
--sql
if the column type is correct first and if so not process the alter table
script
alter table EventVenueTransaction alter column RowGUID uniqueidentifier NOT
NULL
GO
Is there a way I can do this.
Regards
Jeff
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.698 / Virus Database: 455 - Release Date: 2/06/2004You can use the following statement to test for the correct datatype but if
you just want to alter it anyway then there is no need to do the test first.
If the ALTER TABLE statement doesn't change the properties of the column
then it will have no effect anyway.
IF
(SELECT data_type
FROM information_schema.columns
WHERE table_name = 'EventVenueTransaction'
AND column_name = 'rowguid')
<> 'uniqueidentifier'
..
David Portas
SQL Server MVP
--sql
Sunday, February 19, 2012
Chart borders not hiding when no data is returned
I do not have much experience with reporting services or Visual Studio.
I'm trying to upgrade some reports from reporting services 2000 to
reporting services 2005. One of the reports I'm working on contains 5
charts. In the 2000 environment when no data is returned for a single
chart, the chart is not displayed and the next chart that contains data
is "moved up" in the display. In 2005 when no data is returned for a
chart, a blank chart (basically an outline) is displayed. So may I end
up seeing a chart or two, then a blank area, and then another chart
instead of seeing all charts that return data displayed sequentially.
I hope that wasn't too confusing and that someone may be able to help
me with this.I want to clear this up a little... bascially I'm getting blank charts
as placeholders in the report. If no data is returned then I do not
want an empty chart /placeholder... instead I want charts with data to
shift up.|||Use an expression on the Visibility --> Hidden property for the chart
and test for rows returned, something like:
=IIF(rownumber("YourQuery") = 0, True, False)
I've also hit this same issue after upgrading reports from RS2000 to
RS2005.
Matt A
Rabbit wrote:
> I want to clear this up a little... bascially I'm getting blank charts
> as placeholders in the report. If no data is returned then I do not
> want an empty chart /placeholder... instead I want charts with data to
> shift up.
I'm trying to upgrade some reports from reporting services 2000 to
reporting services 2005. One of the reports I'm working on contains 5
charts. In the 2000 environment when no data is returned for a single
chart, the chart is not displayed and the next chart that contains data
is "moved up" in the display. In 2005 when no data is returned for a
chart, a blank chart (basically an outline) is displayed. So may I end
up seeing a chart or two, then a blank area, and then another chart
instead of seeing all charts that return data displayed sequentially.
I hope that wasn't too confusing and that someone may be able to help
me with this.I want to clear this up a little... bascially I'm getting blank charts
as placeholders in the report. If no data is returned then I do not
want an empty chart /placeholder... instead I want charts with data to
shift up.|||Use an expression on the Visibility --> Hidden property for the chart
and test for rows returned, something like:
=IIF(rownumber("YourQuery") = 0, True, False)
I've also hit this same issue after upgrading reports from RS2000 to
RS2005.
Matt A
Rabbit wrote:
> I want to clear this up a little... bascially I'm getting blank charts
> as placeholders in the report. If no data is returned then I do not
> want an empty chart /placeholder... instead I want charts with data to
> shift up.
Subscribe to:
Posts (Atom)