Showing posts with label dummy. Show all posts
Showing posts with label dummy. Show all posts

Monday, March 19, 2012

Dummy Where Clause Allowing Dummy Select Of Data - Utilizing Where value = 1

Years ago, I remember while doing maintenance on a stored procedure seeing a 'Select x, y, z Where 'some value' = 1.

The function of this, I believe was to make the select work but not retrieve any actual values.

I am attempting to use this in an 'Insert Into Select values From' statement. This insert uses multiple selects via unions and I need a final dummy Select statement with no Where criteria.

What I am thinking may not even apply to what I need to do here.

If you recognize something even remotely near what I am trying to get across I would appreciate your sending me the code.

Another solution for me is just inserting one row with a final RecId = 6 and ' ' or 0 values for the other fields into a table

but I was hoping this would work.

Example:

Insert Into table

Select

1 as RecId,

' ' as field1,

field2

From test1

Where field2 = 'CA'

Union

Select

2 as RecId,

' ' as field1,

field2

From test1

Where field2 = 'NJ'

Union

/*Final Select */

Select

6 as RecId,

' ' as field1,

field2

From test1

Where 'some value' = 1'

Thanks much for your assistance!!!

TADEG

If you want to create a dummy select that never returns rows, just add WHERE 0=1 to the end.

Code Snippet

SELECT x,y,x FROM Table WHERE 0=1

Dummy Table?

Hi!

I'm new in SQL SERVER 2000 and i'm looking for some kind of predefined dummy table. You know something like the "dual"-Table in Oracle. I want to use it for queries like that:

Select 1, 'auto' from dummy_table

Does anyone know, if something like that in SQL SERVER 2000 exists?

NickOriginally posted by nick792
Hi!

I'm new in SQL SERVER 2000 and i'm looking for some kind of predefined dummy table. You know something like the "dual"-Table in Oracle. I want to use it for queries like that:

Select 1, 'auto' from dummy_table

Does anyone know, if something like that in SQL SERVER 2000 exists?

Nick

There is no dummy table in sql server.
you can just use
select 1,'auto'
it will select 1 and the literal 'auto'
what is 'auto'?
regards,
harshal.|||U don't have to mention the "from dummytable" part.

Just
"select '123' " would be fine in SQL Server, as opposite to Oracle
where u need to have it as
"select '123' from dual"|||Thanks!
It works!

"auto" is german for "car"!

Nick|||I was wondering...Oracle, DB2, ect all have this 1 Row system table so you can do like sql server does, but without the FROM clause...

The question is...does ANSI consider this a "malformed" query syntax without the FROM?

Just curious.|||seems to me i've heard someone say that the FROM clause is not required in some recent sql standard, however, when i test a sample query in the various sql versions of the Mimer SQL Validator (http://developer.mimer.se/validator/index.htm), they all come back with an error

dummy table in SQL Server

Hi, Is there a dummy table in SQL Server just like DUAL in Oracle?
Thanks..I don't think so. The MS-SQL scripting language parser has always been able to do without the need for anything like dual, so there has never been one.

-PatP|||EDIT: [sniped]

Don't Need one...

SELECT 'A'
GO

Oracle would be SELECT 'A' FROM DUAL;

DB2 would be SELECT 'A' FROM sysibm.sysdummy1;|||Thats for your reply guys...
Brett, thats the answer I was looking for.

Dummy Question

It seems every month when I'm diluged by lots of data I fall back on ole
reliable, Excel. But, I get over 50,000 rows of data to scrub. A colleague
of mine suggested I use a database. Seems simple so far, but having dabbled
in Access, it has always not so intuitive to understand. My question is
two-fold, is SQL a database. I believe its the language of some other
database. If I'm corrent on the later, what database(s) use SQL?

TonyTony,

There's a lot of ground to cover with that one simple question :) SQL
is an abbreviation for Structured Query Language, and it's a language
that is used primarily to retrieve and manipulate data that is stored
in a database system.

There are as many dialects of SQL as there are databases; Access uses
Jet-SQL, SQL Server and Sybase both use Transact-SQL, Oracle has
PL/SQL, and so on. Most databases adhere to a form of generic SQL know
as ANSI-SQL, but there adherance varies.

You may want to start here:
http://en.wikipedia.org/wiki/SQL

HTH,
Stu

ajocius wrote:
> It seems every month when I'm diluged by lots of data I fall back on ole
> reliable, Excel. But, I get over 50,000 rows of data to scrub. A colleague
> of mine suggested I use a database. Seems simple so far, but having dabbled
> in Access, it has always not so intuitive to understand. My question is
> two-fold, is SQL a database. I believe its the language of some other
> database. If I'm corrent on the later, what database(s) use SQL?
> Tony

Dummy Keyword in SQL Server

Hi
SQL Server 2000 has an undocumented key word called DUMMY. Does anybody know
how this could be used ?
Thanksdummy is no longer a keyword (or a reserved word) in sql server 2000
you can create a table or a column with that name now.

Dummy dimension for passing parameters

Hi,

I'm just having a little problem... I have a calculation, which is a non-trivial formula. This needs input from some dimensions (no problem with that...) and some information, which is independant from the data itself. The idea is to have something like a dimension but which is not connected to the data itself. You can't slice anything using it, it's just used to provide some input for the formula. Just imagine you have some amounts and you want to display the interests for them. The interests are nothing from the cube, they just are needed as input for the formula to calculate the interests. In the cube you only have the amount. Sure, you can add different measures for each interest rate you need, but this might be quite a pain...

Any idea?

Thomas,

You might be able to get what you want by using the same method as was outlined in an article on building a dimension for "cell annotations". Here is the link:

http://www.sqlserveranalysisservices.com/OLAPPapers/Cell%20Annotations%20in%20AS2005v1.htm

The idea is that you have a dimension table that has a compound key made up of the key values that identify a cell in the cube and then the additional attributes can be comments or a formula or whatever you want. You can then retrieve information from the dimension using the script as outlined in the article. The annotations dimension does not have to be related to any measure group.

HTH,

- Steve

|||

Hi Thomas,

AS2005 supports dimensions which aren't connected to any measure group in your cube - just go to the Dimensions tab in the Cube Editor, click on the box at the intersection of the dimension and the measure group, and set the 'Relationship Type' property in the dropdown at the top of the dialog to 'No Relationship'. I've used this method several times to include dimensions in cubes which don't affect any of the regular measures but which are used in calculations to control how they behave.

Regards,

Chris

|||

Chris,

thanks, works perfectly... It's just too easy to find out ;-)

Hope you had a good trip back from PASS... Your session helped me very much to do the custom rollups I asked you about... Seams to work, but some crasy things going on with the scopes... But that's something for later...