ODBC Error Code = S0002 (Base Table Not Found)

Nov 20, 2001

I have converted a access database to sql server 2000 for some reason i keep getting this error base table not found.
I know the sql database is there and i also know the table is there. I'm not sure why i keep getting this error..


thanks

View 2 Replies


ADVERTISEMENT

ODBC/OLE DB Error Code 0

May 25, 2004

Hey All:

Getting Code 0 errors in ActiveX scripts within DTS & can't trap the decription(s).
I remember seeing an OLD Thread on expanding the Code 0 errors but can't find it.

RobbieD

View 2 Replies View Related

ODBC Error Code = 40001 (Serialization Failure)

Sep 22, 2004

We get this error constantly...

24.121.0.118, Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322), ODBC Error Code = 40001 (Serialization failure) [Microsoft][ODBC SQL Server Driver][SQL Server]Transaction (Process ID 56) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction.


Any ideas? Would setting the isolation level to Read Commited help?

View 1 Replies View Related

Error (8626) While Inserting Record Into Table With Text Field And Which Is The Base For Indexed View

Mar 14, 2006

I have a problem with inserting records into table when an indexed viewis based on it.Table has text field (without it there is no problem, but I need it).Here is a sample code:USE testGOCREATE TABLE dbo.aTable ([id] INT NOT NULL, [text] TEXT NOT NULL)GOCREATE VIEW dbo.aViewWITH SCHEMABINDING ASSELECT [id], CAST([text] AS VARCHAR(8000)) [text]FROM dbo.aTableGOCREATE TRIGGER dbo.aTrigger ON dbo.aView INSTEAD OF INSERTASBEGININSERT INTO aTableSELECT [id], [text]FROM insertedENDGODo the insert into aTable (also through aView).INSERT INTO dbo.aTable VALUES (1, 'a')INSERT INTO dbo.aView VALUES (2, 'b')Still do not have any problem. But when I need index on viewCREATE UNIQUE CLUSTERED INDEX [id] ON dbo.aView ([id])GOI get following error while inserting record into aTable:-- Server: Msg 8626, Level 16, State 1, Procedure aTrigger, Line 4-- Only text pointers are allowed in work tables, never text, ntext, orimage columns. The query processor produced a query plan that requireda text, ntext, or image column in a work table.Does anyone know what causes the error?

View 1 Replies View Related

#Table Not Found Error Using Stored Procedure For DataSet

Aug 29, 2007

Hi all

I have a procedure where I am inserting some elements into #Table and then finally get the datset I need.
Now when I am using this procedure as dataset to my report, it throws up the following error:





Invalid object Name "#TEMP2".

The data that I retrieve is similar to the data that I get from this query in the post by Manivannan.D.Sekaran
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1871478&SiteID=1

Is it because my columns are generated on the fly that I am not able to retrieve the column headers appropriately. If so can someone suggest a way over to this?

I am not sure should I posting it here or in T-SQL Forum.








View 17 Replies View Related

ODBC SQL Server Driver Name Pipes Not Found

Apr 6, 2001

I have a new MS SQL 7 server with patch 3.
I am getting this error from a MS SQL client pc, whend I use the SQL server Query analyzer, both logon options "SQL Server or Windows authentication"
I even tried the SA account.

here is the error I get.

MSG 6 Level 16 State 1 ODBC SQL Server Driver name Pipes specified SQL Server
not found.

Any help will be apriciated thank you.
Jorge

View 1 Replies View Related

Vista MYSQL ODBC Manager Data Source Not Found

Nov 26, 2007

I am testing an application that uses mysql that works 100% fine with Microsoft Windows XP on Windows Vista Premium Home Edition.

Using Vista's ODBC Data Source Administrator I have set up and successfuly tested the DSN Connection to the Database.

However, when I call the set up DSN with the application I get [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified.

I am using the mysql-connector-odbc-3.51.12-win32.

I have tried editing the registry DSN files - the problem still persists.

Does anybody know a way to solve this problem

View 1 Replies View Related

Table Query Fails With Object Not Found Error After Assining Sysadmin Server Role To Login

May 14, 2015

I have dw schema in the database, owned by user dw.The login name is dw. The login had db_owner right in the database. The default schema for the login on the database is dw.Now Once I assign 'sysadmin' serverrole to dw login, I started seeing stored proc not found error, if try to execute stored proc without mentioning dw.spname...Also I am seeing table not found error while quering tables under dw schema, after the change.

View 5 Replies View Related

SSIS Error Code DTS_E_OLEDBERROR. An OLE DB Error Has Occurred. Error Code: 0x8000FFFF.

Jan 28, 2008

Hi All,

Recently in an SSIS package I am getting the following error for a particular Data flow task.





Error: 2008-01-25 12:01:48.58

Code: 0xC0202009

Source: Import Datasynapse Data User Events Source [3017]

Description: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x8000FFFF.

End Error

Error: 2008-01-25 12:01:48.73

Code: 0xC004701A

Source: Import Datasynapse Data DTS.Pipeline

Description: component "User Events Source" (3017) failed the pre-execute phase and returned error code 0xC0202009.

End Error

Our guess is when the data size of User Events table is more it throws this error. If we try to transfer small subset of data it succeeds. What could be reason for this error?

Since this is very urgent, immediate response would be very much appreciated.

Thanks & Regards,
Prakash Srinivasan

View 4 Replies View Related

The Connection Is Not Found. This Error Is Thrown By Connections Collection When The Specific Connection Element Is Not Found

May 1, 2007

I've got a package which reads a text file into a table and updates another. I set up configurations so that I could import it into the SSIS store on both my dev and live servers. Now, I'm getting this error. I tried removing the configs and am still getting it.

I've been through each step and everything looks okay. Does anyone have any idea (a) what's wrong, (b) how to localise the error or (c) get any additional information? Or do I just have to recreate the package from scratch?



TITLE: Package Validation Error
------------------------------

Package Validation Error

------------------------------
ADDITIONAL INFORMATION:

Error at PartnerLinkFlatFileImporter: The connection "" is not found. This error is thrown by Connections collection when the specific connection element is not found.

Error at PartnerLinkFlatFileImporter [Log provider "SSIS log provider for SQL Server"]: The connection manager "" is not found. A component failed to find the connection manager in the Connections collection.

(Microsoft.DataTransformationServices.VsIntegration)

------------------------------
BUTTONS:

OK
------------------------------

View 20 Replies View Related

Odbc Error Linked Table Access

Sep 27, 2006

I have access97 front end , with linked tables to sql server 2005. when i change a table ID column (type int) to primary key so it is updatable, then try open the table i get odbc error with no msg, if i alter table again to remove primary key option table opens fine but is not updateable. any ideas would be a great help

View 5 Replies View Related

SQL 2012 :: Migration Of SSIS Script - (binary Code Not Found)

Jul 6, 2015

exporting an SSIS from a 2008 R2 SQL Server and re-import it into a SQL 2012.

I have inherited an SQL 2008 R2 Server running two SSIS packages. I have both as .dtsx files and & a manifest to install.The task at hand is now to migrate those to a new SQL 2012 server.[There is also an IIS running on that machine and project-specific .dll and stuff within the IIS document root. I do not know if these .dlls relate to the IIS web page or to the SQL .dtsx) But the migrated web site runs fine].

Installation of the packages into the MSDB works out flawlessly and one of the scripts runs fine, but the other fails to run with the error:

"Error: the binary code for the script is not found. Please open the script in the designer by clicking Edit Script button and make sure it builds successfully."

Google tell me something about a "Pre-compile option"-setting on server as explained here. I can not find this option setting anywhere in SSMS. Also as the migration is from 2008 R2 -> 2012 this should not be relevant as in both versions pre-compilation should be automatic, right?

- I installed visual studio 2013 community

- I installed SSDTBI

- Start the "Integration Services Import Project Wizard"

to import the SSIS directly from the "Integration Services Catalog"

However, things don't quite work very well - Trying to import (from the locally installed SQL instance) it will not display the tree of SSIS stuff, but only the root directory.

So importing directly from the running system won't work. Let's see if we can get somewhere with the .dtsx As I _do_ actually have the .dtsx files here, why not open them up directly in Visual studio and try to get compiled whatever needs to be compiled.I create a new "integration Services" Project and open up the .dtsx into this project. ==> LOTS of errors of all kind.

(The job of this script is to fetch messages from an Exchange.)But opening up this specific bit of code doesn't work a bit - there is no binary code in it and how to reate it or where to get it from...

View 4 Replies View Related

Odbc-timeout Error On A Linked Table From Access2k

Dec 12, 2006

Hi.I have the problem that some records in a ms sqlserver table is unableto update from Access.I get the error message odbc-time out error in linked table......I tried to copy this table to another database, where none but me wasaktive.And then it worked quit ok when I try to save the record.I am thinking about if there is some trigger och restraint that Idon't know about, but I don't know how to se all of this in thedatabase.I have changed the odbc-timeout settings in Access but that doesn'tseed to make any differenceSo what's the problem?Does anyone have an idea?/regards BigOlle

View 1 Replies View Related

How Can I Manage Database On Lan Base[network Base]software

Jul 20, 2005

himy self avicurrently i am developing one application in vb 6 and back end assqlserver 7 which is used on lan.i have some problem. like in my database i have one table salesvoucherwhich has 'voucherno' field. when 2-3 user will work on salesform at atime [since the softwrae will run on lan] then the same voucherno willsave for all users data which is wrong i need to save different vouchernofor each no. is there any way in sqlserver to apply some condition ondatabase or to set some its property[tables] so that at a time only oneusers data will save depend on firstcome first serve base or is there anyway to make changes in programme.plz help me regarding this i need it very badly.since its my first lan based software plz give me some books nameregarding this software for vb6 and sqlserver7

View 2 Replies View Related

How Do I Use SendMail Option In The Integration Services - I Found The Code On MSDN, But, How Do I Make It Workable?

May 14, 2007

if I have the following code:


using Microsoft.SqlServer.Dts.Runtime;
using Microsoft.SqlServer.Dts.Tasks.SendMailTask;

class TestSendMailTask
{

public static void Main()
{

Package pkg = new Package();

ConnectionManager smtpCM;
smtpCM = pkg.Connections.Add("SMTP");
smtpCM.Name = "SMTP Connection Manager";
smtpCM.ConnectionString = "smtphost";

Executable exe = pkg.Executables.Add("STOCKendMailTask");
TaskHost thSendMailTask = (TaskHost)exe;
{
thSendMailTask.Properties["SmtpConnection"].SetValue(thSendMailTask, "SMTP Connection Manager");
thSendMailTask.Properties["ToLine"].SetValue(thSendMailTask, "someone1@example.com");
thSendMailTask.Properties["CCLine"].SetValue(thSendMailTask, "someone2@example.com");
thSendMailTask.Properties["BCCLine"].SetValue(thSendMailTask, "someone3@example.com");
thSendMailTask.Properties["FromLine"].SetValue(thSendMailTask, "someone4@example.com");
thSendMailTask.Properties["Priority"].SetValue(thSendMailTask, MailPriority.Normal);
thSendMailTask.Properties["FileAttachments"].SetValue(thSendMailTask, "C:\test_image.jpg");
thSendMailTask.Properties["Subject"].SetValue(thSendMailTask, "Testing the SendMail Task");
thSendMailTask.Properties["MessageSourceType"].SetValue(thSendMailTask, SendMailMessageSourceType.DirectInput);
thSendMailTask.Properties["MessageSource"].SetValue(thSendMailTask, "This is only a test.");
}

DTSExecResult valResults = pkg.Validate(pkg.Connections, pkg.Variables, null, null);

if (valResults == DTSExecResult.Success)
{
pkg.Execute();
}

}

}



-------

How do I make it a workable package so it compiles , w/ javadoc style comments and instructions, so, other people can use it?

View 20 Replies View Related

Integration Services :: SSIS 2012 Script Component Binary Code Not Found

Apr 21, 2015

After adding Service Reference  to WebService, the Script Component has Binary Code not found, red circle not showing these are the steps I followed:

1) Add Script Component as Source
2) Add 3 x Output Columns Col1,2 and 3
3) Add HTTP Connection URL>..Binary Code not found, red circle showing
4) Add test code to Sub CreateNewOutputRows     Dim i As Integer = 6       Binary Code not found, red circle not showing
5) Add Service Reference URL...Binary Code not found, red circle showing again

Should just adding Service Reference cause Binary Code not found, red circle to appear. I have to set  precompilescripttobinary option , however cannot see this option in 2012

View 3 Replies View Related

Trigger For Updating Value On One Table When That Value Is Updated On Base Table

Jul 30, 2015

If the id1 will change in table1 it should also change the corresponding id1 field in table2 it does not do anything.

CREATE TRIGGER [dbo].[IDCHANGE]
ON [dbo].[table1]
AFTER UPDATE
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from

[Code] .....

View 1 Replies View Related

ODBC Driver Example Code

Dec 20, 2007

I am new to Microsoft and have been tasked with writting and ODBC Driver.

I've looked through the MSDN site and found a number of articles that discuss ODBC Driver development. I've read through the ODBC API reference manual and have a pretty good idea what needs to be done.

What I need to move forward is to find some example code that I can look at. An article that identifies the steps to creating and deploying an ODBC driver would be great!

Does anyone know where I can find some ODBC Driver example code? Would it help if I had an MSDN Subscription?

Any suggestions would be appreciated.

Thanks,

View 3 Replies View Related

How To Dynamically Enter Error Code And Description In A Pre-define Table?

Aug 4, 2006

Hi,

I want to implement error handling my SSIS package. for this I am putting an execute SQL task for a container(which contains different interlinked tasks) in event handler.

Say my first task fails in this container.Immedaitely my sql task which inserts the error code and description should exceute in the event handler and populate my error table in OLAP database.

Any help will be great SSIS gurus.

Thanks in advance.

Regards,

Aman

View 4 Replies View Related

Get A Max Value From One Table Base On Date From Another.

Jul 20, 2006

I have a problem where I need to join multiple tables. Part of the query needs me to make the following relationship in a join.

Say I have a table with items, prices, and dates.

PriceTable

ITEM PRICE DATE

A 1.00 5/5/2000

B 3.00 1/1/2000

A 2.50 6/5/2004

....

This table represents an items price from the date on. So Item 'A' costed 1.00 from 5/5/2000 through 6/5/2004, then it costed 2.50 from that day on.

Now say I have a table of transactions with items, amount bought, and dates.

TransactionTable

ITEM AMOUNT DATE

A 5 6/6/2003

A 1 8/5/2003

A 2 8/5/2004

The total for A should come out to be 11.00. There are multiple Items and multiple price changes.

If someone could point out how a inner join of this nature would work it will help me in my query. I guess the reason i say inner join is because I am joining multiple other tables to do my query.



My current Price Table has a start date and an end date and my query looks something like this. "Select SUM(PriceTable.Price * TransactionTable.Amount) From PriceTable Inner Join TransactionTable ON TransactionTable.Date Between PriceTable.StartDate and PriceTable.EndDate AND PriceTable.Item = TransactionTable.Item".



I want something like this because the tables need to be in the format above "Select SUM(PriceTable.Price * TransactionTable.Amount) From PriceTable INNER JOIN TransactionTable ON Max(PriceTable.Date) WHERE PriceTable.Date <= TransactionTable.Date AND PriceTable.Item = TransactionTable.Item".

Hope that made sense, thanks.

View 3 Replies View Related

Sample Code To Importing Data From ODBC

Mar 26, 2007

Hi, there;
I try to import data from ODBC using C# programmatically. Is there any sample code we can have a look. Like how to read schema from ODBC source table and then create source column...

Thanks

View 3 Replies View Related

ERROR [42000] [Lotus][ODBC Lotus Notes]Table Reference Has To Be A Table Name Or An Outer Join Escape Clause In A FROM Clause

May 27, 2008

I am using web developer 2008, while connecting to I wanted to fetch data from Lotus notes database file, for this i used notesql connector, while connectiong to notes database i am fetting error


ERROR [42000] [Lotus][ODBC Lotus Notes]Table reference has to be a table name or an outer join escape clause in a FROM clause


I have already checked that database & table name are correct, please help me out
How i can fetch the lotus notes data in my asp.net pages.

View 1 Replies View Related

ERROR [42000] [Lotus][ODBC Lotus Notes]Table Reference Has To Be A Table Name Or An Outer Join Escape Clause In A FROM Clause

May 27, 2008

I am using web developer 2008, while connecting to I wanted to fetch data from Lotus notes database file, for this i used notesql connector, while connectiong to notes database i am fetting error


ERROR [42000] [Lotus][ODBC Lotus Notes]Table reference has to be a table name or an outer join escape clause in a FROM clause


I have already checked that database & table name are correct, please help me out
How i can fetch the lotus notes data in my asp.net pages.

View 1 Replies View Related

Error In Adding New SQL Data Base

Dec 31, 2007

Hi..
When I try to add new item "SQL Data Base" the following error generate:
Failed to generate a user instance of SQL server due to a failure in starting the process for the user instance. The connection will be closed.
what is mean? what is its reason? how I can solved?
Please help me as soon as possible..
Thanks..

View 2 Replies View Related

Error On Data Base Diagram

Apr 17, 2007

When I try to create a new diagram it sends me an error message:

Server Name: TICSQLEXPRESS
Error Number: 207
Severity: 16
State: 1
Procedure: sp_upgraddiagrams
Line Number: 55

Invalid column name 'uvalue'.
Invalid column name 'uvalue'.
Could not find stored procedure 'dbo.sp_upgraddiagrams'.
Object is invalid. Extended properties are not permitted on 'dbo.sysdiagrams', or the object does not exist.
Object is invalid. Extended properties are not permitted on 'dbo.sp_upgraddiagrams', or the object does not exist. (.Net SqlClient Data Provider)


What is this?

View 1 Replies View Related

[Microsoft][ODBC Driver Manager] Data Source Name Not Found And No Default Driver Specified

Oct 19, 2006

trying to install sql server2005 on a windows 2003 server box.

getting msg below at the sql server . i looked at other posts on trying to uninstall SQL Native Access Client and norton antivirus. i could never find the snac on the add - remove programs and this server does not have a virus protection program yet.

here's the history of the installs on the server:

wanted to test a 2005 upgrade so:

1) installed sql server 2000 then sp4 then restored some databases to it - all OK

2) tried to upgrade to sql 2005 but ran into problems and left it at that.

had a disk drive crash on the d drive so lost the installs but not the operating system

when the drive was replaced, left alone for a while

then wanted to test a straight 2005 install

1) removed the broken 2005 attempt

2) removed the 2000

3) installed 2005 and got the error on the subject line:

TITLE: Microsoft SQL Server 2005 Setup
------------------------------

SQL Server Setup could not connect to the database service for server configuration. The error was: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified Refer to server error logs and setup logs for more information. For details on how to view setup logs, see "How to View Setup Log Files" in SQL Server Books Online.

i've gone through as many of the forums that i can and have tried several things - like uninstalling 2005 and installing pieces and parts but but nothing seems to work.

Thanks!

Dan <><

View 17 Replies View Related

Sql2005 ODBC Driver Manager Data Source Name Not Found And No Default Driver Specified

Feb 4, 2008

i am attempting to run phpbb using ms sql 2005 on the same box but get the following error during the setup


Could not connect to the database, see error message below.
[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified


i am not sure yet if this is an issue with sql, php or phpbb

php is installed in iis and has all the modules installed which the php msi installer supported. i can run php code but in this case when i'm running the install.php file for the phphbb setup, i fill in the values for the database and got that error

phpbb detects all the required server settings and sees that i have ms sql installed

any suggestions on what that error means or how to go about configuring odbc driver?

probably a simple issue. but i'm still new with sql stuff

View 1 Replies View Related

SQL Server VARCHAR(MAX) Column Returns Error While Inserting Records Into Table(ODBC Driver: SQL Native Client)

Aug 15, 2007

I created very simple table with 3 columns and one is varchar(max) datatype

When i insert records thru VC++ ADO code i am getting this error



Exception Description Multiple-step OLE DB operation generated errors. Check e
ach OLE DB status value, if available. No work was done. and Error Number:: -2147217887



ODBC Driver: SQL Native Client

SQL server 2005



Table

CREATE TABLE [dbo].[RAVI_TEMP](

[ID] [int] NULL,

[Name] [varchar](max) NULL,

[CITY] [varchar](50) NULL

)



VC++ code

#include "stdafx.h"
#include <string>
#include <strstream>
#include <iomanip>


int main(int argc, char* argv[])
{
try
{
HRESULT hr = CoInitialize(NULL);
_RecordsetPtr pExtRst = NULL;
_bstr_t bstrtDSN, bstrtSQL;
bstrtDSN = L"DSN=espinfo;UID=opsuser;PWD=opsuser;";
bstrtSQL = L"SELECT * FROM RAVI_TEMP";

_variant_t vartValueID,vartValueNAME,vartValueCITY;
_bstr_t bstrtValueID,bstrtValueNAME,bstrtValueCITY;

pExtRst.CreateInstance(__uuidof(Recordset));
hr = pExtRst->Open(bstrtSQL, bstrtDSN, adOpenDynamic, adLockOptimistic, adCmdText);

hr = pExtRst->AddNew();

bstrtValueID = L"1";
vartValueID = bstrtValueID.copy();

bstrtValueNAME = L"RAVIBABUBANDARU";
vartValueNAME = bstrtValueNAME.copy();

bstrtValueCITY = L"Santa Clara";
vartValueCITY = bstrtValueCITY.copy();

pExtRst->GetFields()->GetItem(L"ID")->Value = vartValueID;
pExtRst->GetFields()->GetItem(L"NAME")->Value = vartValueNAME;
pExtRst->GetFields()->GetItem(L"CITY")->Value = vartValueCITY;
pExtRst->Update();
pExtRst->Close();

}
catch(_com_error e)
{
printf("Exception Description %s and Error Number:: %d",(LPTSTR)e.Description(),e.Error());
return e.Error();
}
return 0;
CoUninitialize();
}


if i use regular SQL ODBC driver, no error but its truncating the data



Adv Thanks for your help

View 1 Replies View Related

Can I Add A Row To A Data Base Table With VWD Express

Dec 21, 2005

I have a data table I have adabted for my own use and want to add a row to the table. Can I do that with Visual Web developer Express?
I can add update modify the colums and data in the exciting table but I cannot figure out how to add a row.
This is just a simple datalist of names. firstname lastname. there are 18 of them and i want to add more names

View 7 Replies View Related

How Do I Identify The Base Table For A PageID?

Jul 19, 2007

Hi,

Have a LOB error which provides the corrupt PageID and this recommends a DBCC CHECKDB. However I'm unable to identify what the base table for the PageID. DBCC PAGE does not provide base table info (I think), DBCC PGLINKAGE has been retired in SS2005 and DBCC READPAGE doesn't work either.

Does any know of a valid SS2005 command or technique which will allow my to identify the base table for a PageID???

View 1 Replies View Related

How To Identify The Base Table For A PageID ?

Jul 19, 2007

Hi,

Have a LOB error which provides the corrupt PageID and this recommends a DBCC CHECKDB. However I'm unable to identify what the base table for the PageID. DBCC PAGE does not provide base table info (I think), DBCC PGLINKAGE has been retired in SS2005 and DBCC READPAGE doesn't work either.

Does any know of a valid SS2005 command or technique which will allow my to identify the base table for a PageID???

View 4 Replies View Related

Truth Table Generator For Any Base!

Jul 25, 2007

This little handy algorithm provides a truth table for any range of numbers between 0 and 65535 of any base between 2 and 36!
As a twist, you can either return the digits concatenated or as separate columns.CREATE PROCEDURE dbo.uspTruthTable
(
@FromNumber SMALLINT = 0,
@ToNumber INT = 255,
@Step INT = 1,
@Base TINYINT = 2,
@Concat BIT = 0
)
AS

SET NOCOUNT ON

DECLARE @Temp INT,
@SQL VARCHAR(8000),
@b VARCHAR(12),
@d VARCHAR(2),
@Diff INT,
@Digits CHAR(36)

IF @FromNumber > @ToNumber
SELECT@Temp = @FromNumber,
@FromNumber = @ToNumber,
@ToNumber = @Temp

IF @FromNumber < 0
BEGIN
RAISERROR('The parameter FromNumber %d is less than 0 (base 10).', 16, 1, @FromNumber)
RETURN
END

IF @ToNumber > 65535
BEGIN
RAISERROR('The parameter ToNumber %d is greater than 65535 (base 10).', 16, 1, @ToNumber)
RETURN
END

IF @Base < 2
BEGIN
RAISERROR('The parameter Base %d is less than 2 (base 10).', 16, 1, @Base)
RETURN
END

IF @Base > 36
BEGIN
RAISERROR('The parameter Base %d is greater than 36 (base 10).', 16, 1, @Base)
RETURN
END

SELECT@SQL = '',
@Temp = FLOOR(LOG(@ToNumber) / LOG(@Base)),
@Diff = @ToNumber - @FromNumber + 1,
@Digits = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'

WHILE @Temp >=0
SELECT@b = CONVERT(VARCHAR, @Base),
@d = CONVERT(VARCHAR, @Temp),
@SQL = @SQL +CASE
WHEN @Concat = 1 THEN '+SUBSTRING(''' + @Digits + ''',1 + Number/POWER(' + @b + ',' + @d + ') % ' + @b + ', 1)'
ELSE ',SUBSTRING(''' + @Digits + ''',1 + Number/POWER(' + @b + ',' + @d + ') % ' + @b + ', 1) AS Digit' + @d
END,
@Temp = @Temp - 1

CREATE TABLE#Numbers
(
Number INT PRIMARY KEY
)

INSERT#Numbers
(
Number
)
VALUES(
@FromNumber
)

WHILE @Step <= @Diff
BEGIN
INSERT#Numbers
SELECT@Step + Number
FROM#Numbers
WHERENumber <= @ToNumber - @Step

SET@Step = @Step * 2
END

IF @Concat = 1
SET @SQL = 'SELECT Number, ''''' + @SQL + ' AS Digits FROM #Numbers ORDER BY Number'
ELSE
SET @SQL = 'SELECT Number' + @SQL + ' FROM #Numbers ORDER BY Number'

EXEC (@SQL)

DROP TABLE #NumbersYou can use the algorithm like these examplesEXEC dbo.uspTruthTable
EXEC dbo.uspTruthTable 0, 255, 1, 8
EXEC dbo.uspTruthTable DEFAULT, 15, 1, 2
E 12°55'05.76"
N 56°04'39.42"

View 2 Replies View Related

Derive Base Table/column From View

Aug 19, 2002

Is there any way to get the base table/column from a view by supplying the view name/column name_in_view? I know about INFORMATION_SCHEMA.VIEW_COLUMN_USAGE, but it doesn't always work. Try it on a regular database, not pubs. Any help is appreciated!

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved