Showing posts with label type. Show all posts
Showing posts with label type. Show all posts

Thursday, March 22, 2012

Calculated Column based on the last record

Hi everyone,

I am thinking of this is possible:

ID Type TypeID

1 car 1

2 car 2

3 house 1

4 car 3

5 house 2

6 house 3

7 car 4

8 car 5

9 car 6

10 house 4

I have identity column (ID), Varchar (Type), Int (TypeID)

I need the TypeID to be an identity for each Type column, incremented the same way as the ID column but values depends on the Type column value.

How can I calculate this?

Thanks!

Use 2 tables.

Table 1:

Set concatenated primary key as Type + TypeID identity

Table 2:

Primary Key Identity ID int

Type varchar()

TypeID int

Adamus

|||

Try:

Code Snippet

create table dbo.t1 (

ID int not null identity,

[Type] varchar(25) not null

)

go

insert into dbo.t1([Type]) values('car')

insert into dbo.t1([Type]) values('car')

insert into dbo.t1([Type]) values('house')

insert into dbo.t1([Type]) values('car')

insert into dbo.t1([Type]) values('house')

insert into dbo.t1([Type]) values('house')

insert into dbo.t1([Type]) values('car')

insert into dbo.t1([Type]) values('car')

insert into dbo.t1([Type]) values('car')

insert into dbo.t1([Type]) values('house')

go

select

ID,

[Type],

(

select count(*)

from dbo.t1 as b

where b.[Type] = a.[Type] and b.ID <= a.ID

) as TypeID

from

dbo.t1 as a

order by

[Type],

[TypeID]

go

-- SS 2005

select

ID,

[Type],

row_number() over(partition by [Type] order by ID) as TypeID

from

dbo.t1

order by

[Type],

[TypeID]

go

drop table dbo.t1

go

AMB

|||

Since this is a derivable value, rather than using a column in the base table consider using an expression to extract the ranking value. In general cases folks use a view or a computed column for such requirements. In t-SQL, here are a few options:

-- #1

SELECT "id", "type",
RANK() OVER ( PARTITION BY "type" ORDER BY "id" )
FROM tbl
ORDER BY "id" ;

--#2

SELECT "id", "type",
( SELECT COUNT(*) FROM tbl t2
WHERE t2.type = t1.type
AND t2."id" <= t1."id" )
FROM tbl t1 ;

--#2

SELECT t1."id", t1."type", COUNT(*)
FROM tbl t1
JOIN tbl t2
ON t2.type = t1.type
AND t2."id" <= t1."id"
GROUP BY t1."id", t1."type"
ORDER BY t1."id";

|||

I'd like to comment that although both posted approaches will work, it may be the beginning of a maintenance nightmare. If, in fact, the values will be stored and not derived, 2 tables would support good design and optimize the cognition when alterations on the query are required.

Also, if they are calculated, why not calculate on insert?

Adamus

|||

thanks!

i created a stored procedure to insert calculated column using the row_number() over(partition by [Type] order by ID) as TypeID

Monday, March 19, 2012

calc totals for months question

I have the following records:
Unit Create_date Type
A 01/02/2004 Clock
A 01/15/2004 Car
A 01/20/2004 Truck
A 01/23/2004 Clock
A 01/24/2004 Clock
A 01/25/2004 Car
A 01/27/2004 Truck
A 02/01/2004 Clock
A 02/02/2004 Car
A 02/15/2004 Truck
A 02/20/2004 Car
A 02/27/2004 Car
A 06/03/2004 Truck
A 06/04/2004 Truck
A 06/15/2004 Clock
A 06/29/2004 Car
Report Output example
Unit Created Type
A Jan 04 Clock
Type Count = 3
A Jan 04 Car
Type Count = 2
A Jan 04 Truck
Type Count = 2
Total for January = 7
A Feb 04 Clock
Type Count = 1
A Feb 04 Car
Type Count = 3
A Feb 04 Truck
Type Count = 1
Total for February = 5
A June 04 Clock
Type Count = 1
A June 04 Car
Type Count = 1
A June 04 Truck
Type Count = 2
Total for June = 4
I am trying to determine how to count the totals for the months.
Any ideas?
Thanks.Just use a table, and add a table grouping "MonthGrouping" like e.g.:
=Year(Fields!TimeStamp.Value)*100 + Month(Fields!TimeStamp.Value)
Then add a second (inner) table grouping "TypeGrouping" which groups on the
type, e.g.: =Fields!Type.Value
These two groupings should give you the basic structure of the desired
output. Finally, to determine the counts for the months, just add an
expression like this to the "MonthGrouping" groop footer:
=CountRows("MonthGrouping")
--
This posting is provided "AS IS" with no warranties, and confers no rights.
"Mike" <Mike@.discussions.microsoft.com> wrote in message
news:83250B36-B1BC-4601-9002-87EDE106838E@.microsoft.com...
>I have the following records:
> Unit Create_date Type
> A 01/02/2004 Clock
> A 01/15/2004 Car
> A 01/20/2004 Truck
> A 01/23/2004 Clock
> A 01/24/2004 Clock
> A 01/25/2004 Car
> A 01/27/2004 Truck
> A 02/01/2004 Clock
> A 02/02/2004 Car
> A 02/15/2004 Truck
> A 02/20/2004 Car
> A 02/27/2004 Car
> A 06/03/2004 Truck
> A 06/04/2004 Truck
> A 06/15/2004 Clock
> A 06/29/2004 Car
> Report Output example
> Unit Created Type
> A Jan 04 Clock
> Type Count = 3
> A Jan 04 Car
> Type Count = 2
> A Jan 04 Truck
> Type Count = 2
> Total for January = 7
> A Feb 04 Clock
> Type Count = 1
> A Feb 04 Car
> Type Count = 3
> A Feb 04 Truck
> Type Count = 1
> Total for February = 5
> A June 04 Clock
> Type Count = 1
> A June 04 Car
> Type Count = 1
> A June 04 Truck
> Type Count = 2
> Total for June = 4
> I am trying to determine how to count the totals for the months.
> Any ideas?
>
> Thanks.
>

Thursday, March 8, 2012

Caching or reusing parameters populated with SqlCommandBuilder.DeriveParameters

Hello,

I have a real heartache with runtime parameter interogation on my DB.
Sure I get the latest and greatest and sure I don't have to type in all those lovely parameter types..but...the hit I take on performance for making no less then 3 DB hits for each SqlAdapter is unreasonable!

So ...I like the idea of maybe calling it once for all my stored procs on application startup...and then maybe saving this in CacheObject.

My problem is that I can't see where you can even serialize a SqlParametersCollection or even for that matter assign it to a Command object. Can you cache a command object ?

LOL

I think I may just have to write some generic routine for creating and populating my command objects based on a key (type) and then use that to fetch my command.Update,
command.Insert and command.

I would like to use the new AsynchBlock to do the fetching of the stored proc parameters and then just pull them from the Cache object...put a file watch so that if the DB's change my params it re-pulls them again.

*nice*....

Then I get the best of both worlds...caching...and no parameter writing...

Ericsp_sproc_columns [[@.procedure_name =] 'name']
[,[@.procedure_owner =] 'owner']
[,[@.procedure_qualifier =] 'qualifier']
[,[@.column_name =] 'column_name']
[,[@.ODBCVer =] 'ODBCVer']

sp_stored_procedures [[@.sp_name =] 'name']
[,[@.sp_owner =] 'owner']
[,[@.sp_qualifier =] 'qualifier']

does that help?|||well yeah that's what I was going to do once I have the params in some cachable state...
I was just wondering if you could fetch the SqlParametersCollection from the Command object...alal IDbCommandParameters

and then cache those dudes...:)

I can manually interogate my hash for the parameters based on type key..."UpdSales", "InsSales","DelSales"...etc..|||those are the system procedures you need to get ALL the procedures from your database, then get their parameters.

Check out the details from books online.|||Duh...

I know that!

The SqlCommandBuilder.DerieveParameters(SqlCommand)

And those parameters have to stored somewhere in command object right?

Ahhh the Parameters which implments the IDbParameterCollection...

So can you fetch or store that Parameters collection...

That is what I"m asking...

I think I will just write the code "AsyncService" to fetch them at Application on start and then store them....I just don't like all those chatty calls ...that's all

Caching Linked Server Queries

Hi,
Is the result of query via Linked Server cached? Or it depends on the data
source type of Linked Server? What about the exeution plan?
Thanks,
Leila
Leila (Leilas@.hotpop.com) writes:
> Is the result of query via Linked Server cached? Or it depends on the data
> source type of Linked Server? What about the exeution plan?
The result is not cached. The exucution plan is cached, just like for
any other query.
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx

Caching Linked Server Queries

Hi,
Is the result of query via Linked Server cached? Or it depends on the data
source type of Linked Server? What about the exeution plan?
Thanks,
LeilaLeila (Leilas@.hotpop.com) writes:
> Is the result of query via Linked Server cached? Or it depends on the data
> source type of Linked Server? What about the exeution plan?
The result is not cached. The exucution plan is cached, just like for
any other query.
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx

Caching Linked Server Queries

Hi,
Is the result of query via Linked Server cached? Or it depends on the data
source type of Linked Server? What about the exeution plan?
Thanks,
LeilaLeila (Leilas@.hotpop.com) writes:
> Is the result of query via Linked Server cached? Or it depends on the data
> source type of Linked Server? What about the exeution plan?
The result is not cached. The exucution plan is cached, just like for
any other query.
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pr...oads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodin...ions/books.mspx

CacheType in Lookup for Oracle OLEDB connection

Hi,

1. If I have millions of rows to be compared, then which cache type is prefereed for lookup, Partial or no caching?

2. If I have lookup connected to Oracle Oledb, cache type as partial and SqlCommandParam as following

select * from (SELECT ORDER_ID, OPER_KEY, STEP_KEY, SUM(OCCUR_COUNT) AS OCCUR_COUNT FROM SFWID_OPER_DESC_EXPLD GROUP BY ORDER_ID, OPER_KEY, STEP_KEY) refTable where refTable.ORDER_ID = ? and refTable.OPER_KEY = ? and refTable.STEP_KEY = ?

then it doesn't allow me to add the parameters from Advance tab of Lookup transformation edition, and raises following error

"Provider cannot derive parameter information and SetParametInfo has not been called"

what am I missing?

1. Depends on the amount of memory available and the size of the data set to be cached. A million of rows should not be a big deal; but you do the math; find the size of the row(using just the required columns) and multiply by the number of rows. You should provide a query instead selecting the table from the drop down list.

2. In SSIS mapping parameters in a half-way complex query is some times impossible. So try re-writing the query in a simpler way (perhaps creating a view). BTW, if you parametrize the query; then only partial cache will be used; meaning the query will be executed for every row in the pipeline, affecting negatively the performance of the package

|||

Rafael,

Is it possible that we dont define parameterized query for partial cache?

I had done following things:

For the partial caching, I have checked Enable memory restriction and Enable caching and has set the cache size. I have not checked "Modify sql statement" option. But, "SqlCommandParam" in advanced editor shows the query as follows:

select * from
(SELECT ORDER_ID, OPER_KEY, STEP_KEY, SUM(OCCUR_COUNT) AS OCCUR_COUNT FROM SFWID_OPER_DESC_EXPLD GROUP BY ORDER_ID, OPER_KEY, STEP_KEY) as refTable where [refTable].[ORDER_ID] = ? and [refTable].[OPER_KEY] = ? and [refTable].[STEP_KEY] = ?

But as this is not the perfect syntax for oracle, it showed the error. Thats why I have changed this query to following

select * from (SELECT ORDER_ID, OPER_KEY, STEP_KEY, SUM(OCCUR_COUNT) AS OCCUR_COUNT FROM SFWID_OPER_DESC_EXPLD GROUP BY ORDER_ID, OPER_KEY, STEP_KEY) refTable where refTable.ORDER_ID = ? and refTable.OPER_KEY = ? and refTable.STEP_KEY = ?

Now after the change, running the package throws the following error at this lookup

Error: An OLE DB error has occurred. Error code: 0x80040E5D. An OLE DB record is available. Source: "Microsoft OLE DB Provider for Oracle" Hresult: 0x80040E5D Description: "Parameter name is unrecognized.".

So, I went to advanced tab and checked "Modify sql statement" option but it doesnt allow me to add the parameter and throws the error as said in my earlier post.

|||

Is there any special reason for using partial cache? for performance reasons I would not recommned it; but in some cases it is necessary.

*I think* when you use partial cache the lookup uses a query w/parameters; so I don't think you have control over that. I know SSIS parameter mapping and Oracle are not very easy to get working; and I don't know how easy or possible is that in a Lookup transformtion. Search this forum for 'Oracle parameters' to see if you can find somthing helpful.

|||

I searched but couldn't find anything useful. Is it so that Lookup caching doesn't support Oracle parameters ?

Thanks,

Pratibha

|||

Hi Pratibha:

Did you find anything on using parameters in lookups for Oracle OLEDB. Please let me know if you have any workaround. I am also stuck in the same problem.

Any help will be greatly appreciated.

Thanks,

Vipul

Sunday, February 19, 2012

c# and sql server for windows ce

hello,
i use in c# the following line:
using System.Data.SqlServerCe;
the following error is visible
"The type or namespace name 'SqlCeEngine' could not be found"
how can i fix this problem?Have you added a reference to SQLCe?
Have you installed SQL Ce on the device?
"Steiner Hubert" <nospam@.firemail2.de> wrote in message
news:O9vYtTx6DHA.1596@.TK2MSFTNGP10.phx.gbl...
> hello,
> i use in c# the following line:
> using System.Data.SqlServerCe;
> the following error is visible
> "The type or namespace name 'SqlCeEngine' could not be found"
> how can i fix this problem?
>

Thursday, February 16, 2012

byte manipulation for int

I've got a column that is as type int(length=4).
This column is getting changed to smallint. Obviously, some values in
the column will not fit into smallint type. I've been told that as part
of moving data over, I should ignore top two bytes and carry forward
the bottom two bytes - so that it will fit into smallint.
e.g. values in the column is:
TableA
--
Col1
4235623
Pls can someone help/point me in the right direction as to how I could
do it via TSQL.
Thanks,
SandiyanYou can use Bitwise And:
UPDATE YourTable
SET col = col & 65535
ALTER TABLE YourTable ALTER COLUMN col SMALLINT NOT NULL
I'm slightly puzzled as to why this would ever make sense though. Are
you really storing bitmapped values in an INTEGER column?
David Portas
SQL Server MVP
--|||Thanks and appreciate your help. I knew there must have been an easier
solution!...
The way I got it to work was (a bit long winded!):
cast(substring (cast(ColA as binary(4)), 3, 2) as smallint)
regards
Sandiyan.
David Portas wrote:
> You can use Bitwise And:
> UPDATE YourTable
> SET col = col & 65535
> ALTER TABLE YourTable ALTER COLUMN col SMALLINT NOT NULL
> I'm slightly puzzled as to why this would ever make sense though. Are
> you really storing bitmapped values in an INTEGER column?
> --
> David Portas
> SQL Server MVP
> --|||David,
This doesn't quite do it. & results of 0x8000 and higher will
fail, because the result, 0x0000' is a positive int, and
smallint cannot hold positive integers greater than 0x00007FFF.
create table T (i int)
go
insert into T values (2000000000)
go
update T set i = i & 65535
go
alter table T alter column i smallint
go
drop table T
Server: Msg 220, Level 16, State 1, Line 1
Arithmetic overflow error for data type smallint, value = 37888.
The statement has been terminated.
I think SUBSTRING is a good idea (not that I understand
why the OP wants to throw data away), but here is one solution
similar to yours:
update T set i = (i+32768) & 65535 - 32768
SK
David Portas wrote:

>You can use Bitwise And:
>UPDATE YourTable
> SET col = col & 65535
>ALTER TABLE YourTable ALTER COLUMN col SMALLINT NOT NULL
>I'm slightly puzzled as to why this would ever make sense though. Are
>you really storing bitmapped values in an INTEGER column?
>
>|||Thanks Steve. A good catch.
David Portas
SQL Server MVP
--|||Why do you think that this will work? Why does this make an sense to
you?

byte manipulation for int

I've got a column that is as type int(length=4).
This column is getting changed to smallint. Obviously, some values in
the column will not fit into smallint type. I've been told that as part
of moving data over, I should ignore top two bytes and carry forward
the bottom two bytes - so that it will fit into smallint.
e.g. values in the column is:
TableA
Col1
4235623
Pls can someone help/point me in the right direction as to how I could
do it via TSQL.
Thanks,
Sandiyan
You can use Bitwise And:
UPDATE YourTable
SET col = col & 65535
ALTER TABLE YourTable ALTER COLUMN col SMALLINT NOT NULL
I'm slightly puzzled as to why this would ever make sense though. Are
you really storing bitmapped values in an INTEGER column?
David Portas
SQL Server MVP
|||Thanks and appreciate your help. I knew there must have been an easier
solution!...
The way I got it to work was (a bit long winded!):
cast(substring (cast(ColA as binary(4)), 3, 2) as smallint)
regards
Sandiyan.
David Portas wrote:
> You can use Bitwise And:
> UPDATE YourTable
> SET col = col & 65535
> ALTER TABLE YourTable ALTER COLUMN col SMALLINT NOT NULL
> I'm slightly puzzled as to why this would ever make sense though. Are
> you really storing bitmapped values in an INTEGER column?
> --
> David Portas
> SQL Server MVP
> --
|||David,
This doesn't quite do it. & results of 0x8000 and higher will
fail, because the result, 0x0000? is a positive int, and
smallint cannot hold positive integers greater than 0x00007FFF.
create table T (i int)
go
insert into T values (2000000000)
go
update T set i = i & 65535
go
alter table T alter column i smallint
go
drop table T
Server: Msg 220, Level 16, State 1, Line 1
Arithmetic overflow error for data type smallint, value = 37888.
The statement has been terminated.
I think SUBSTRING is a good idea (not that I understand
why the OP wants to throw data away), but here is one solution
similar to yours:
update T set i = (i+32768) & 65535 - 32768
SK
David Portas wrote:

>You can use Bitwise And:
>UPDATE YourTable
> SET col = col & 65535
>ALTER TABLE YourTable ALTER COLUMN col SMALLINT NOT NULL
>I'm slightly puzzled as to why this would ever make sense though. Are
>you really storing bitmapped values in an INTEGER column?
>
>
|||Thanks Steve. A good catch.
David Portas
SQL Server MVP
|||Why do you think that this will work? Why does this make an sense to
you?

byte manipulation for int

I've got a column that is as type int(length=4).
This column is getting changed to smallint. Obviously, some values in
the column will not fit into smallint type. I've been told that as part
of moving data over, I should ignore top two bytes and carry forward
the bottom two bytes - so that it will fit into smallint.
e.g. values in the column is:
TableA
--
Col1
4235623
Pls can someone help/point me in the right direction as to how I could
do it via TSQL.
Thanks,
SandiyanYou can use Bitwise And:
UPDATE YourTable
SET col = col & 65535
ALTER TABLE YourTable ALTER COLUMN col SMALLINT NOT NULL
I'm slightly puzzled as to why this would ever make sense though. Are
you really storing bitmapped values in an INTEGER column?
David Portas
SQL Server MVP
--|||Thanks and appreciate your help. I knew there must have been an easier
solution!...
The way I got it to work was (a bit long winded!):
cast(substring (cast(ColA as binary(4)), 3, 2) as smallint)
regards
Sandiyan.
David Portas wrote:
> You can use Bitwise And:
> UPDATE YourTable
> SET col = col & 65535
> ALTER TABLE YourTable ALTER COLUMN col SMALLINT NOT NULL
> I'm slightly puzzled as to why this would ever make sense though. Are
> you really storing bitmapped values in an INTEGER column?
> --
> David Portas
> SQL Server MVP
> --|||David,
This doesn't quite do it. & results of 0x8000 and higher will
fail, because the result, 0x0000' is a positive int, and
smallint cannot hold positive integers greater than 0x00007FFF.
create table T (i int)
go
insert into T values (2000000000)
go
update T set i = i & 65535
go
alter table T alter column i smallint
go
drop table T
Server: Msg 220, Level 16, State 1, Line 1
Arithmetic overflow error for data type smallint, value = 37888.
The statement has been terminated.
I think SUBSTRING is a good idea (not that I understand
why the OP wants to throw data away), but here is one solution
similar to yours:
update T set i = (i+32768) & 65535 - 32768
SK
David Portas wrote:

>You can use Bitwise And:
>UPDATE YourTable
> SET col = col & 65535
>ALTER TABLE YourTable ALTER COLUMN col SMALLINT NOT NULL
>I'm slightly puzzled as to why this would ever make sense though. Are
>you really storing bitmapped values in an INTEGER column?
>
>|||Thanks Steve. A good catch.
David Portas
SQL Server MVP
--|||Why do you think that this will work? Why does this make an sense to
you?

byte manipulation for int

I've got a column that is as type int(length=4).
This column is getting changed to smallint. Obviously, some values in
the column will not fit into smallint type. I've been told that as part
of moving data over, I should ignore top two bytes and carry forward
the bottom two bytes - so that it will fit into smallint.
e.g. values in the column is:
TableA
--
Col1
4235623
Pls can someone help/point me in the right direction as to how I could
do it via TSQL.
Thanks,
SandiyanYou can use Bitwise And:
UPDATE YourTable
SET col = col & 65535
ALTER TABLE YourTable ALTER COLUMN col SMALLINT NOT NULL
I'm slightly puzzled as to why this would ever make sense though. Are
you really storing bitmapped values in an INTEGER column?
--
David Portas
SQL Server MVP
--|||Thanks and appreciate your help. I knew there must have been an easier
solution!...
The way I got it to work was (a bit long winded!):
cast(substring (cast(ColA as binary(4)), 3, 2) as smallint)
regards
Sandiyan.
David Portas wrote:
> You can use Bitwise And:
> UPDATE YourTable
> SET col = col & 65535
> ALTER TABLE YourTable ALTER COLUMN col SMALLINT NOT NULL
> I'm slightly puzzled as to why this would ever make sense though. Are
> you really storing bitmapped values in an INTEGER column?
> --
> David Portas
> SQL Server MVP
> --|||David,
This doesn't quite do it. & results of 0x8000 and higher will
fail, because the result, 0x0000' is a positive int, and
smallint cannot hold positive integers greater than 0x00007FFF.
create table T (i int)
go
insert into T values (2000000000)
go
update T set i = i & 65535
go
alter table T alter column i smallint
go
drop table T
Server: Msg 220, Level 16, State 1, Line 1
Arithmetic overflow error for data type smallint, value = 37888.
The statement has been terminated.
I think SUBSTRING is a good idea (not that I understand
why the OP wants to throw data away), but here is one solution
similar to yours:
update T set i = (i+32768) & 65535 - 32768
SK
David Portas wrote:
>You can use Bitwise And:
>UPDATE YourTable
> SET col = col & 65535
>ALTER TABLE YourTable ALTER COLUMN col SMALLINT NOT NULL
>I'm slightly puzzled as to why this would ever make sense though. Are
>you really storing bitmapped values in an INTEGER column?
>
>|||Thanks Steve. A good catch.
--
David Portas
SQL Server MVP
--|||Why do you think that this will work? Why does this make an sense to
you?

Tuesday, February 14, 2012

But the documentation is NOT correct

The documentation says

ISNUMERIC returns 1 when the input expression evaluates to a valid
integer, floating point number, money or decimal type; otherwise it
returns 0. A return value of 1 guarantees that expression can be
converted to one of these numeric types.

(Cut and pasted from books online)

Yet the following, one of many, example shows this is not true.

select isnumeric(char(9))
select convert(int, char(9))

----
1

(1 row(s) affected)

Server: Msg 245, Level 16, State 1, Line 2
Syntax error converting the varchar value '' to a column of data type
int.

So, besides filtering every possible invalid character, how do you
convert dirty values without error. I am not concerned that I may loose
possibly valid values or convert suspect strings to 0 (zero). I just
want to run without raising an errorBooks Online is quite correct here, it just could be a bit clearer. The
significant word in the paragraph you posted is "or". ISNUMERIC returns
1 if the data is convertible to ANY of the datatypes listed. Try the
following, which will work:

SELECT CONVERT(MONEY, CHAR(9))

If you just want to convert positive integers then you can use LIKE to
determine whether a string contains only numerics:

SELECT CAST(col AS INTEGER)
FROM YourTable
WHERE col NOT LIKE '%[^0-9]%'

--
David Portas
SQL Server MVP
--|||By inference then CONVERT(MONEY, x) is the most 'tolerant' conversion.
Strings containing only numerics is also elegant.

Thanks for the tip|||(bilbo.baggins@.freesurf.ch) writes:
> By inference then CONVERT(MONEY, x) is the most 'tolerant' conversion.

Not necessarily:

SELECT convert(money, '1E1')

bombs. But isnumeric() returns 1.

isnumeric is a useless function.

--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp

Sunday, February 12, 2012

Business Intelligence Project?

I installed the VS 2005 Beta and didn't see the business intelligence project type. How do I get that project type in my list? Do I need SQL 2005 installed on the same machine?In VS2003, you just needed to install the SQL Server client tools to access the Business Intelligence project type. I'm not sure if there's an option in the current SQL Server 2005 install to just install the client piececs.

I'd suggest just installing the whole thing, it should make your development easier (that way, even if you turn off SQL Server locally, you'll still have the Management Studio to manage/connect to your remote databases ... very handy unless you like setting up remote desktops or walking between servers).

Here's also a list of installation notes on integrating SQL Server 2005 and Visual Studio which you may find helpful:
http://www.sqlservercentral.com/columnists/drussell/technoteinstallingsqlserver2005andvisualstudio2005.asp

Hope this helps,
Josh Lindenmuth

Business Intelligence project type not found in visual studio 2005

Hi,

I have installed sql server 2005 and visual studio 2005 on windows server 2003. When I select business intelligence studio from sql server, visual studio editor opens up,but i cannot find business intelligence projects template in visual studio. Please suggest some solution or workaround.

Thanks,

Y Gupta

Verify that you have installed the Workstation components under SQL Setup, on that machine. BI Projects should be the top node in the Project Types list on the left hand side of the New Project dialog. There is no workaround, just a valid install.

Business Intelligence Project type missing

Using VS.Net 2003, I don't have the Business Intelligence Project type. I
have installed Reporting Services today and would like to start creating
some projects with it.
When installing reporting services, I didn't install the server software on
the same machine as VS.Net. I don't need to do that do I?
Thanks in advance,
MarkMBRUND wrote:
> Using VS.Net 2003, I don't have the Business Intelligence Project type. I
> have installed Reporting Services today and would like to start creating
> some projects with it.
> When installing reporting services, I didn't install the server software on
> the same machine as VS.Net. I don't need to do that do I?
> Thanks in advance,
> Mark
>
Yup. You need to install the client tools on your development box.
Matt|||The server does not need the client software and the client software does
not need the server software. They can both be installed but they do not
need to be. Wherever you install the client software you need VS installed.
Bruce L-C
"MBRUND" <mark.brundieck@.midwestwirelessREMOVE_CAPS_AND_INVALID.com.invalid>
wrote in message news:OfobUD6YEHA.3892@.TK2MSFTNGP09.phx.gbl...
> Using VS.Net 2003, I don't have the Business Intelligence Project type. I
> have installed Reporting Services today and would like to start creating
> some projects with it.
> When installing reporting services, I didn't install the server software
on
> the same machine as VS.Net. I don't need to do that do I?
> Thanks in advance,
> Mark
>|||The server is already installed OK and others are able to program against it
using Business Intelligence Projects from VS.Net, but I can't though I have
installed the client the same way the others have.
I'm not sure what else is different about the VS.Net 2003 suite we are using
the the Reporting Services client software that is installed on the
machines. Any ideas what to look for? However, they are using Windows XP as
OS and I am using Windows 2000 Server.
Mark
"Bruce Loehle-Conger" <bruce_lcNOSPAM@.hotmail.com> wrote in message
news:O8v4nk6YEHA.996@.TK2MSFTNGP12.phx.gbl...
> The server does not need the client software and the client software does
> not need the server software. They can both be installed but they do not
> need to be. Wherever you install the client software you need VS
installed.
> Bruce L-C
> "MBRUND"
<mark.brundieck@.midwestwirelessREMOVE_CAPS_AND_INVALID.com.invalid>
> wrote in message news:OfobUD6YEHA.3892@.TK2MSFTNGP09.phx.gbl...
> > Using VS.Net 2003, I don't have the Business Intelligence Project type.
I
> > have installed Reporting Services today and would like to start creating
> > some projects with it.
> >
> > When installing reporting services, I didn't install the server software
> on
> > the same machine as VS.Net. I don't need to do that do I?
> >
> > Thanks in advance,
> > Mark
> >
> >
>|||Found it!
My bad. I have both VS.Net 2002 and VS.Net 2003 on this machine and didn't
expect it. I was looking for the project type using 2002, but I found it now
under 2003. Surprise! Now to get rid of 2002 ...
Thanks for your time.
"MBRUND" <mark.brundieck@.midwestwirelessREMOVE_CAPS_AND_INVALID.com.invalid>
wrote in message news:%23Dk4s7DZEHA.3944@.tk2msftngp13.phx.gbl...
> The server is already installed OK and others are able to program against
it
> using Business Intelligence Projects from VS.Net, but I can't though I
have
> installed the client the same way the others have.
> I'm not sure what else is different about the VS.Net 2003 suite we are
using
> the the Reporting Services client software that is installed on the
> machines. Any ideas what to look for? However, they are using Windows XP
as
> OS and I am using Windows 2000 Server.
> Mark
> "Bruce Loehle-Conger" <bruce_lcNOSPAM@.hotmail.com> wrote in message
> news:O8v4nk6YEHA.996@.TK2MSFTNGP12.phx.gbl...
> > The server does not need the client software and the client software
does
> > not need the server software. They can both be installed but they do not
> > need to be. Wherever you install the client software you need VS
> installed.
> >
> > Bruce L-C
> >
> > "MBRUND"
> <mark.brundieck@.midwestwirelessREMOVE_CAPS_AND_INVALID.com.invalid>
> > wrote in message news:OfobUD6YEHA.3892@.TK2MSFTNGP09.phx.gbl...
> > > Using VS.Net 2003, I don't have the Business Intelligence Project
type.
> I
> > > have installed Reporting Services today and would like to start
creating
> > > some projects with it.
> > >
> > > When installing reporting services, I didn't install the server
software
> > on
> > > the same machine as VS.Net. I don't need to do that do I?
> > >
> > > Thanks in advance,
> > > Mark
> > >
> > >
> >
> >
>

Business Intelligence Project

Hello

Where can I download the project type for reporting services? I need this for Visual Studios 2003.

thanksYou can get this only by installing the designer components from the SQL Reporting Services 2000 setup.

-Daniel|||

Do you know where I can find that to download?

Christine

|||You can get the trial version from here:
http://www.microsoft.com/downloads/details.aspx?FamilyID=ba517c01-2e2f-4bc7-84af-149b7637f807&DisplayLang=en

This is the same as the full version. The designer components are not trial versions and will not expire after 180 days.

-Daniel|||Thank you. I appreciate the help

Business Intelligence Project

Hello

Where can I download the project type for reporting services? I need this for Visual Studios 2003.

thanksYou can get this only by installing the designer components from the SQL Reporting Services 2000 setup.

-Daniel|||

Do you know where I can find that to download?

Christine

|||You can get the trial version from here:
http://www.microsoft.com/downloads/details.aspx?FamilyID=ba517c01-2e2f-4bc7-84af-149b7637f807&DisplayLang=en

This is the same as the full version. The designer components are not trial versions and will not expire after 180 days.

-Daniel|||Thank you. I appreciate the help