|
I have a query like
SELECT * FROM SomeTable WHERE SomeColumn In('FirstValue','SecondValue') . But the number of items in the IN is not predictable. How do I write a parameterized query then ? If I know the number of items in the IN, I know I can write
SELECT * FROM SomeTable WHERE SomeColumn In(@FirstParam,@SecondParam) . Is there anyway to do the same when the number is unknown?
|
|
|
|
|
Hi,
As far as I know you have to either declare each parameter separately or somehow change the structure. Some possibilities could be:
1.
create a function for evaluating condition. Something like
SELECT * FROM SomeTable WHERE OwnFunction(SomeTable.SomeColumn, neededParameters) = 1
This way you could use arrays for passing values to function
2.
Use temp-table and insert the values in temp table before select. Something like
CREATE TABLE #Values(value...)
INSERT INTO #Values...
SELECT * FROM SomeTable a WHERE EXISTS (SELECT 1 FROM #Values b WHERE a.SomeColumn = b.Value)
3.
Place the whole query into procedure and pass the parameters to the procedure and return a table
Hope this helps,
Mika
|
|
|
|
|
If you're creating the query in code; yes. If you're trying to write a stored procedure, function, or view; no.
|
|
|
|
|
Hi, i would need to create a software application using C#.NET. I understand there are database such as MS Access and SQL Server. But is there freeware database? No license needed. Example, PHP MyAdmin which is used for php database and its free.
Thanks
|
|
|
|
|
You can use MySQL. It's powerful.
|
|
|
|
|
Few choices (registration needed in most):
- SQL Server Express Edition for multiuser environment
- SQL Server Compact Edition for singleuser environment
- Oracle XE
- IBM DB 2 Express-C
- MySql
and there are lots more but I think these are the most useful.
Mika
|
|
|
|
|
How about SQL Server Express?
Use Live Search to find it.
“If we are all in agreement on the decision - then I propose we postpone further discussion of this matter until our next meeting to give ourselves time to develop disagreement and perhaps gain some understanding of what the decision is all about.”-Alfred P. Sloan
|
|
|
|
|
The 2 best options I know of are MySQL and PostgreSQL. A couple of differences I've noticed:
1. MySQL Community server is free, unless you redistribute your project not user the GPL license. In this case, you would need to purchase a license. However, if your project is distributed under GPL, then it's still free.
2. PostgreSQL is licensed under the BSD license, so it is completely free to use in any and all situations.
3. From personal experience, MySQL seems to be much faster than PostgreSQL, so if speed is an issue (as it is in my application), I'd go with MySQL.
Dybs
|
|
|
|
|
You can use SQLite. It is a free (public domain) database and it doesn't require an independent installation of a DB server.
It is also very simple to work with (you only need to reference its assembly) and it has reasonable free admin tools.
SQL Server Express is not really free. It has a size limit (4GB), it requires a separate installation (which makes installation more cumbersome) and it uses a separate server.
MySQL is not really free either (for commercial applications at least) and requires a separate installation of the DB server.
If you are interested - go to www.sqlite.org for more information. SQLite also has a very good .net provider (search on google).
Best of luck
Liron
|
|
|
|
|
download sql server 2005 free edition and also download the bob tubor free tutorial videos on microsoft.
nelsonpaixao@yahoo.com.br
|
|
|
|
|
I have a datasource that pulls a IP address. I need to call a function in SQL does the same as the asp class, that converts it to a non dotted format http://www.maxmind.com/app/csv[^]
which I can insert into my destination.
I tried using a lookup data flow item with SELECT [LogTracking].[dbo].[sfnConverIp] (?) but I can not map it to a column with the dotted IP.
There has to be a simple way right?
|
|
|
|
|
Hi,
I was having a discussion with someone much more knowledgeable than mysef about the data designer in VS2005 and I was just hoping to get his thought's on the topic. He was trying to tell me that it is very difficult to find the code for specific things. While I agreed with him, I noted that in almost all cases the code could be changed by using the designer itself, and that the features that were available such as click and drag databinding and the building of the dataset itself were very beneficial. Now I understand that the data designer is a shortcut to avoid writing code but at the end of the day I feel that we need to be more efficient and I know that a project that I am working on right now, I have saved about 1/2 the time by using the data designer. I would be really interested to see what people have to say on the topic.
|
|
|
|
|
Never used it, it's probably rubbish like any "shortcut to avoid writing code", pay attention to "someone much more knowledgeable than mysef".
There's no substitute for getting in there and really understanding what's going on.
|
|
|
|
|
Totally agree
There should be a test in designers that after you can successfully write a solution using code, only then you are allowed to use graphical designer (or tool). I've seen so many total disasters after using a GUI without any knowledge what's happening behind the scenes
|
|
|
|
|
Absolutely in agreement. If you look at how many questions are posted on CP where the real cause of the problem is lack of understanding....
Graphical designers should be banned for all non-GUI work - and before someone gets on their high horse, a well designed DAL means I can execute queries and return almost any type of result set (table, datareader, xml, collection etc) synchronously or asynchronously in about 5 lines of code.
Well, thats my opinion fo what is worth
Bob
Ashfield Consultants Ltd
|
|
|
|
|
-
| |
-- --
|
--
|
--
|
--
-- |
---
That's supposed to be thumb up
|
|
|
|
|
and without a gui designer too
nice one
Bob
Ashfield Consultants Ltd
|
|
|
|
|
Yeah, I didn't pass the test
|
|
|
|
|
Well the data designer allows for data bindings in your gui with point and click action.
|
|
|
|
|
I wouldn't consider that any big advantage - its only a couple of line of code. I would consider an understanding of what happens in the background is far more important.
As I said originally, if you look at how many questions are posted on CP where the real cause of the problem is lack of understanding.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
Have you used the Data Designer before? If so, what happened?
|
|
|
|
|
Yes I did try it, and spent many hours trying to make it fit in with OO principles and struggled to get it working with mutli-table transactions.
I now use a class generator that I wrote myself, which I just point at a stored proc and it will generate a class, or point it at a table and it will generate a class, and the stored procs for CRUD. It also generates a strongly typed collection for each class.
All in all I found it much more time consuming to use the gui data designer and trying to figure out work arounds for when it didn't do what I needed.
I suspect anyne who has been around since before .net is of the same opinion - at least they are where I am currently contracting.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
That's very valuable advice. Thanks a bunch.
|
|
|
|
|
Thats OK, you are welcome.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
After working extensively with visual studio 2005 data designer I came to the conclusion that it is evil. Don't use it if you can. I'd suggest using ORM packages like nhibernate to make mapping from DB to object oriented code more easy.
The problem is that VS data designer work at the table level. It simply maps a data table to a data class. This is a gross mistake because many times you have data that is scattered across many tables but is still owned (logically) by the same class. What happens next is that you have to work very hard to provide this mapping yourself.
Tools like nhibernate can help you alleviate this problem somewhat but now you have another headache to maintain (XML mapping files). Although I think this is better, it is still far from optimal.
The best solution IMHO is that we'll finally have a good, open-source and free (not GPL) object oriented database engine. With such a database you wouldn't need to handle these darn mapping issues at all.
Liron
|
|
|
|