tlbroadbent hit it with the second query. What I want is, indeed, to do a left join on a table with itself. In fact, I want to do it several times. The scenario I have is this, I have been given a table with data in rows that I want to convert to columns.
Example:
RecordID FieldName...
Given a table defined like this:
MyTable
ItemID SubItemID SubItemValue
0 0 0
0 0 15
0 1 20
0 1 25
If I execute this self-join:
select t1.subItemID, t2.SubItemValue
from mytest t1, mytest t2
where t1.subitemid = 1 and...
I'll take a stab at answering my own question. It appears that when you create a stored procedure that does a normal SELECT statement, that statement is executed with the permissions of the user who created the sproc.
However when the proc uses sp_executesql the SQL is executed as the user who...
Hi all.
I'm working on a set of sprocs to act as wrappers to our database and I want to create a new user/role to ONLY have EXECUTE privileges on these procedures.
Now, the procedures themselves are executing SELECT statments on other tables that the user does NOT have privileges to. This is...
I'm using VB and ADO to access my SQL Server 7 tables. The problem I'm running into is that one of my columns is of type TEXT. When I open the recordset on this table, all of the values in the text column are NULL, even when there is definitely data in that column.
Does anyone know what gives...
This may be hopeless, but what I want to do is essentially call a sproc 2 times, each time with different parameters, and then AND/OR the result sets.
What I'd love to do is this:
select * from table where id in
( sproc 'TX' union sproc 'CA' )
Any ideas at all?
Interesting!
I just used Crystal Reports itself, created a new report with the wizard, and chose to use the Active Data connection and I got the same kind of response.
It took about 20 seconds to generate the report.
So does this mean I can't use this approach unless I want to take the...
I ran into this problem and it took me a long time to figure out.
My problem was that I wasn't setting the logon info for the tables I was trying to access.
I don't know how this applies to using a stored procedure, but I had to do this:
Report.Database.Tables.Item(1).SetLogonInfo <server>...
I'm doing it through code. It looks like this:
Dim m_Application As New CRAXDDRT.Application
Dim m_Report As CRAXDDRT.Report
Dim m_ADOrs As ADODB.Recordset
Dim m_ADOcnn As ADODB.Connection
Set m_ADOrs = CreateObject("adodb.recordset")
Set m_ADOcnn =...
Well, from debugging, it appears that the SQLQueryString value stays blank ("") even immediately after my assignment statement. I guess that would explain why the report doesn't have my query. =)
Why would this call not work?
After searching and reading and failing, I hope I can find help from the gurus.
Here's what I'm doing in a nutshell:
1. The basic form (copied from dev. guide) with two tabs (one for report design, one for preview).
2. I want to filter out the records that will show up in the report that the...
There's a bit of a twist to this that I should add.
The full use case of the project here is:
1. User types in a SQL query, hits button
2. Up comes CRDesigner form
3. User chooses fields to use in report
4. User then previews the report and it should reflect only the rows selected by the query...
My project involves the CR 8.5 RDC and Visual Basic and I need to basically let users type in their own SQL queries and press a button and have a report come up that reflects that query.
My first stab was to just use the regular ODBC connection stuff ( Add the tables I want to the report...
I want to do this:
create procedure simple
@col char(40)
as
select * from @col
But that doesn't work. Can anyone help me find out how to pass a variable containing a column name and then use that variable in the select statement?
Thanks!
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.