Showing posts with label method. Show all posts
Showing posts with label method. Show all posts

Monday, March 12, 2012

Non value-type parameters in Assemblies/ CLR UDFs:

I am building a simple utitility to be hosted as a database assembly in SASS 2005. This is a .Net Assembly]

My method is date dependent and I want to pass in a DateTime rather than a string (globalisation issues.. you know the story). Can I do this and how would I pass this parameter in an MDX query?

I also want to pass in such thigs as the StorageMode enum etc. Presumably I can pass in the integer value... (kinda defeats the reason for using enums though)

Update to this, I find that you can pass the DateTime as a string and SSAS does some sort of implicit cast. this is still very sensitive to date string formatting, so is not ideal!|||

Well, it seems that after due consideration I have to answer my own post!

I think the problem is that we can only really pass in basic value types via text in queries, essentially strings and numbers. If I really want to pass in a class/struct I could pass in a string representing the XML Serialized class. For example, if I want to pass in a DateTime rather than a string, I could create an XML version of the DateTime structure. Of course, the alternative for dates would be to specify a universal format, such at the ISO format (yyyy-mm-dd) and ensure that this is rule is always adhered to, but this is coding by convention rather than using strong typing.

Now, my only problem is how to return data in a strongly typed format.... now the XML serialisation seems to be the answer to this one...

Friday, March 9, 2012

Non blocking query on a table in SQL Server 2000

Hi Folks,
How can I invoke a non blocking ODBC query on a table in a SQL Server
database. Our current design requires the method invoking the query to
'return' immediately after invoking the query. The results of the query
should be put in a globally accessible location.
I think SQLFetch is a blocking call.
Thanks,
Vishal
*** Sent via Developersdex http://www.examnotes.net ***
Don't just participate in USENET...get rewarded for it!Vishal,
You have to use muliple threads. It is SQL Execute that usually takes
long time, not SQLFetch(). A call to single SQLFetch usually does not
take long unless you have some network connection problem.
Here is what you can do:
From your main application thread spawn a new one that does
SQLExecute(). The same spawned thread will call SQLFetch and put the
result in a shared buffer, possibly a global to you app. Then send a
Window message to you application notifying it that some data has be put
in the buffer. Read this data from your primary thread.
Regards,
Elvis
Dead not so long ago.
Vishal Prabhu wrote:
quote:

> Hi Folks,
> How can I invoke a non blocking ODBC query on a table in a SQL Server
> database. Our current design requires the method invoking the query to
> 'return' immediately after invoking the query. The results of the query
> should be put in a globally accessible location.
> I think SQLFetch is a blocking call.
> Thanks,
> Vishal
> *** Sent via Developersdex http://www.examnotes.net ***
> Don't just participate in USENET...get rewarded for it!

Non blocking query call

Hi Folks,
How can I invoke a non blocking ODBC query on a table in a SQL Server
database. Our current design requires the method invoking the query to
'return' immediately after invoking the query. The results of the
query should be put in a globally accessible location.
I think SQLFetch is a blocking call.
Thanks,
VishalWhat you are looking for is called Asynchronous Execution. You must enable
async using SQLSetConnectAttr() and SQL_ATTR_ASYNC_ENABLE.
ODBC APIs will return SQL_STILL_EXECUTING while the operation is still
pending. Once the operation completes, the API will return something other
than SQL_STILL_EXECUTING (SQL_SUCCESS if the operation succeeded, etc).
The async model exposed by ODBC is a Poll model, where you have to
periodically poll for completion (instead of a Notification model, where you
are notified that the operation completed).
Brannon Jones
Developer - MDAC
This posting is provided "as is" with no warranties and confers no rights.
"Vishal Prabhu" <vprabhu@.uci.edu> wrote in message
news:31cf0289.0312191118.4354c4fd@.posting.google.com...
quote:

> Hi Folks,
> How can I invoke a non blocking ODBC query on a table in a SQL Server
> database. Our current design requires the method invoking the query to
> 'return' immediately after invoking the query. The results of the
> query should be put in a globally accessible location.
> I think SQLFetch is a blocking call.
> Thanks,
> Vishal

Monday, February 20, 2012

no sync workaround

sql2k
I need to do replication of a between 2 buildings 30 miles apart with 1 T1.
I read about the nosyn method in
http://support.microsoft.com/default...b;en-us;320499
but the hangup Im having with this is putting the DB into Single User Mode.
I see the logic here, but this sucks. Any way to do nosync without using
SUM? A way to start replication using nosync but have it queued up until I
get the box and db at the subscriber up and running?
TIA, ChrisR
the short answer is no.
In such environments I have backed up the database, restored it on the
subscriber, fixed the schema (all constraints are made not for replication,
fixed the identity keys, dropped cascading updates and deletes, made
triggers not for replication, etc), and then done my no sync. I use the
continue on data consistency errors, and patched the subscriber to be in the
same as the publisher. Its a moving target and can be a real chore to fix.
You will need to run numerous validations.
Hilary Cotter
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com
"ChrisR" <noemail@.bla.com> wrote in message
news:uTQO799gFHA.1996@.TK2MSFTNGP10.phx.gbl...
> sql2k
> I need to do replication of a between 2 buildings 30 miles apart with 1
T1.
> I read about the nosyn method in
> http://support.microsoft.com/default...b;en-us;320499
> but the hangup Im having with this is putting the DB into Single User
Mode.
> I see the logic here, but this sucks. Any way to do nosync without using
> SUM? A way to start replication using nosync but have it queued up until I
> get the box and db at the subscriber up and running?
>
> TIA, ChrisR
>
|||I use the
> continue on data consistency errors, and patched the subscriber to be in
> the
> same as the publisher.

> You will need to run numerous validations.
What are these? I have no idea where they are.
"Hilary Cotter" <hilary.cotter@.gmail.com> wrote in message
news:ud7ZdNChFHA.1444@.TK2MSFTNGP10.phx.gbl...
> the short answer is no.
> In such environments I have backed up the database, restored it on the
> subscriber, fixed the schema (all constraints are made not for
> replication,
> fixed the identity keys, dropped cascading updates and deletes, made
> triggers not for replication, etc), and then done my no sync. I use the
> continue on data consistency errors, and patched the subscriber to be in
> the
> same as the publisher. Its a moving target and can be a real chore to fix.
> You will need to run numerous validations.
>
> --
> Hilary Cotter
> Looking for a SQL Server replication book?
> http://www.nwsu.com/0974973602.html
> Looking for a FAQ on Indexing Services/SQL FTS
> http://www.indexserverfaq.com
> "ChrisR" <noemail@.bla.com> wrote in message
> news:uTQO799gFHA.1996@.TK2MSFTNGP10.phx.gbl...
> T1.
> Mode.
>
|||right click on your distribution agent, select agent profiles, and select
continue on data consistency errors.
Hilary Cotter
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com
"ChrisR" <noemail@.bla.com> wrote in message
news:OTLkZFJhFHA.1444@.TK2MSFTNGP10.phx.gbl...
> I use the
>
> What are these? I have no idea where they are.
>
> "Hilary Cotter" <hilary.cotter@.gmail.com> wrote in message
> news:ud7ZdNChFHA.1444@.TK2MSFTNGP10.phx.gbl...
>
|||Awesome! Where do I do a validation.
"Hilary Cotter" <hilary.cotter@.gmail.com> wrote in message
news:OxSQsPNhFHA.3692@.TK2MSFTNGP09.phx.gbl...
> right click on your distribution agent, select agent profiles, and select
> continue on data consistency errors.
> --
> Hilary Cotter
> Looking for a SQL Server replication book?
> http://www.nwsu.com/0974973602.html
> Looking for a FAQ on Indexing Services/SQL FTS
> http://www.indexserverfaq.com
> "ChrisR" <noemail@.bla.com> wrote in message
> news:OTLkZFJhFHA.1444@.TK2MSFTNGP10.phx.gbl...
>