Showing posts with label particular. Show all posts
Showing posts with label particular. Show all posts

Sunday, March 25, 2012

change font weight

i have one doubt

how to change font weight ?Because i have two records in my table i need to change that particular records only i need to change "BOLD"

thanx

You can return this information as an additional column as part of your SQL query. Then in design mode, highlight the details row (or individual testboxes) and make the font weight an expression based on the column in you dataset. e.g.

SELECT type
, font_weight = CASE type WHEN 'special' THEN 'Bold' ELSE 'Normal' END
FROM some_table

Then the expression will read:

=Fields!font_weight.Value

You can apply this technique for most properties not just FontWeight.

Tuesday, March 20, 2012

Change datatype from varchar to bigint not working

Hello,

I would like to change the datatype on a particular column from varchar to bigint across 100's of tables within a database.

I have the command ready which is:

ALTER TABLE tablename ALTER COLUMN columnname BIGINT

The problem happening is that it seems there are constraints across all the columns in every tables.

The error message is:

Server: Msg 5074, Level 16, State 1, Line 1
The object 'DF__tablename__columnname__0ABD916C' is dependent on column 'columnname'.
Server: Msg 4922, Level 16, State 1, Line 1
ALTER TABLE ALTER COLUMN columnname failed because one or more objects access this column.

I understand that if I delete this constraint, then it will let me modify the datatype of the column, but since there are tons of them and they are randomly named, how do I achive changing the datatype across multiple tables in bulk.Hi

This should help you:
http://www.sqlteam.com/article/default-constraint-names

Sunday, March 11, 2012

Change collation in SS7

How can I make just one particular column on a table in SS7 be case-sensitive? I know it can be done in SQL 2000.Afraid you can't. This is a new feature in v2000.

You can code in case sensitivity by

where fld = @.fld
and convert(varbinary,fld) = convert(varbinary,@.fld)

the 'where fld = @.fld' is just so it can use any indexes|||Thanks for the reply.

Thursday, March 8, 2012

change case sensitivity after database set up

I have a SQL Server database hosted with a web hosting company. The
SQL Server was clearly set up to be case sensitive, however, I want
this particular database to be case-insensitive.

I have searched high and low, the best suggestion I can find is to
reinstall SQL Server and select case-insensitive. But since this is
the web host's SQL, that isn't an option here.

With default language I can use the sp_defaultlanguage to change to
British settings (for example). Is there something similar I can use
to make just this database case insensitive?

--

Popular uprising?
http://www.blairfacedlies.org/statue.htm

captain(underscore)flack(squirlything)hotmail(you know what)comIf you are using SQL 2000, you can change the default database collation
with ALTER DATABASE:

ALTER DATABASE MyDatabase
COLLATE SQL_Latin1_General_CP1_CI_AS

Note that a column collation is determined when the column is created so
changing the database setting will not affect existing tables. You'll
need to alter existing columns to the desired collation or recreate the
tables. The collation used for identifiers (table names, column names,
etc.) will take affect immediately.

--
Hope this helps.

Dan Guzman
SQL Server MVP

--------
SQL FAQ links (courtesy Neil Pike):

http://www.ntfaq.com/Articles/Index...epartmentID=800
http://www.sqlserverfaq.com
http://www.mssqlserver.com/faq
--------

"Captain Flack" <captain.flack@.trumpton-firebrigade.dontevenbother>
wrote in message news:o7qhqv8tpvglr61idpqj24kkaqf8p1cruq@.4ax.com...
> I have a SQL Server database hosted with a web hosting company. The
> SQL Server was clearly set up to be case sensitive, however, I want
> this particular database to be case-insensitive.
> I have searched high and low, the best suggestion I can find is to
> reinstall SQL Server and select case-insensitive. But since this is
> the web host's SQL, that isn't an option here.
> With default language I can use the sp_defaultlanguage to change to
> British settings (for example). Is there something similar I can use
> to make just this database case insensitive?
>
>
> --
> Popular uprising?
> http://www.blairfacedlies.org/statue.htm
> captain(underscore)flack(squirlything)hotmail(you know what)com|||On Wed, 05 Nov 2003 13:36:34 GMT, "Dan Guzman"
<danguzman@.nospam-earthlink.net> wrote:

>If you are using SQL 2000, you can change the default database collation
>with ALTER DATABASE:
> ALTER DATABASE MyDatabase
> COLLATE SQL_Latin1_General_CP1_CI_AS
>Note that a column collation is determined when the column is created so
>changing the database setting will not affect existing tables. You'll
>need to alter existing columns to the desired collation or recreate the
>tables. The collation used for identifiers (table names, column names,
>etc.) will take affect immediately.

Thanks, I will test this out. It is SQL 2000 so it looks to be exactly
what I was looking for :)

--

Popular uprising?
http://www.blairfacedlies.org/statue.htm

captain(underscore)flack(squirlything)hotmail(you know what)com

Thursday, February 16, 2012

Category and Subcategory Problem

Hi everyone, I am having trouble with a particular problem with SQL. I have a table that defines product categories like so:

Id (int)
Text varchar(50)
ParentId (int)

It holds all our categories, with subcategories having the appropriate ParentId relating to the above category. I am trying to write a stored procedure that takes in a single Id, and finds out all the related subcategories and subcategories all the way down the tree. I need to produce a resultset with a single column of Id's of all the subcategories etc

For example if the table had the following records:

8 - General - 1
9 - Academic - 1
10 - Science - 1
11 - History - 8
12 - Maths - 8
13 - English - 9
14 - Spanish - 9
15 - England - 13

So if I was to feed in Id 9 the resulting table that I want is like this

9
13
15

My problem is that there isn't a defined number of subcategory levels. General has only 1 subcategory level, but Academic has 2 subcategory levels.

The only part solution I have found was this:

CREATE TABLE #Categories (
CategoryId int)

insert #Categories (CategoryId)
select Id
from Category as c1
where c1.ParentId=8 or c1.Id=8

however it only brings back the first level of subcategories. I was intending to loop this over and over however because of the inconsistent number of levels I can't put in a predefined number of loops.

I have never really faced a problem like this before. I am pretty new to T-SQL and am not sure if there is an easy way to overcome this, but any help would be very much appreciated. I was pretty much ready to pull out my hair yesterday trying to solve this .

I am using SQL Server Express 2005 on Windows Server 2003

Thanks in advance for any help,

Dylan

Please take a look at the link below:

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

You can use recursive CTEs in SQL Server 2005 to write the queries. You can encapsulate those in views or inline TVFs.

|||Thanks that worked great, exactly what I needed.