Designing A Generic Database API

Nov 22, 2005

Hi,

My current project requires me to convert a mysql based software to a more generic one. I started by designing separate db class files and separated the lower level connection queries from the business logic. By doing this, I now have mssql.class, mysql.class, sqllite.class etc..

But am not sure how to handle sql functions in queries. For instance, one of my queries need the use of a date function to add minutes to a db field.

In mysql, I accomplish this using

dbfield+interval '$arg' minute between date1 and date1


But in mssql I cannot use this type of query. It seems I'll have to use date_add() function. How do I handle this situation?

My frontend scripting language is php

Thanks d'advance
Celia

View 1 Replies


ADVERTISEMENT

Generic Database Design

Oct 12, 2007

Hello,
Can someone please guide me to online resources or books on how to design generic database? I mean, I can have a "Record" that can have a set of fixed fields like: ID, Title, CreatedOn, etc ... and I can add as many properties I want to that record in a vertical way.
Then based on the generic tables present, I can fit in the same table, a Record for Customer, a Record for House, a Record for Order. All share the same set of Fields, but each has its own set of proeprties.
This way, I design my database once, and customize it to fit any type of applications I need.
Is there something like that or just dreaming?
thanks

View 6 Replies View Related

Designing A Database Within A Database... Design Question Storing Data...

Jul 23, 2005

I have a system that basically stores a database within a database (I'msure lots have you have done this before in some form or another).At the end of the day, I'm storing the actual data generically in acolumn of type nvarchar(4000), but I want to add support for unlimitedtext. I want to do this in a smart fashion. Right now I am leaningtowards putting 2 nullable Value fields:ValueLong ntext nullableValueShort nvarchar(4000) nullableand dynamically storing the info in one or the other depending on thesize. ASP.NET does this exact very thing in it's Session State model;look at the ASPStateTempSessions table. This table has both aSessionItemShort of type varbinary (7000) and a SessionItemLong of typeImage.My question is, is it better to user varbinary (7000) and Image? I'mthinking maybe I should go down this path, simply because ASP.NET does,but I don't really know why. Does anyone know what would be the benifitof using varbinary and Image datatypes? If it's just to allow saving ofbinary data, then I don't really need that right now (and I don't thinkASP.NET does either). Are there any other reasons?thanks,dave

View 7 Replies View Related

How To Connect Generic Database Field To Report?

Jul 23, 2007

Hello,



I want to make a report where multiple users can use the same report to connect to their databases and then print out the report with information from those databases. Both databases have the exact same tables and fields but the data that is in them is different. However, I have only been able to figure out how to connect the report to one specific database, and therefore the report always prints out information from that database instead of the user specified one. So let's say I want my report to print out the name that is in the database field Name for any database I connect to, how would I do this?

View 8 Replies View Related

Database Designing...

Apr 5, 2004

Friends,
Who is responsible for the Design of Database? System Analyst, DBA, Databse Designer, Project Leader? Coz I am working as a System Analyst, but now desgining the Databse for the ERP package which I feel is another man's work. Confussed. Plz help me.

Anil

View 14 Replies View Related

Database Designing Tools

Jun 9, 2004

Hi all,
Does anyone know how I can design the database schema. I mean what tools can be used to the design the database and view the table relationships, etc. TIA.

Vik!

View 1 Replies View Related

Things To Consider While Designing Database

Dec 5, 2005

One interviewer has asked me the following question:
What are the things that you consider while designing database?
I have told about integrity constraints, and normal forms.
but he has added 15 more concepts like
1. indexers
2. Table columns
3. Table rows
4. search facilities
6.......
Can any one give full Idea on this question?
Thanking you     Ashok kumar.

View 1 Replies View Related

Database Schema Designing

Feb 26, 2004

Case 1:
A company is involved into e-commerce..hosting multiple websites for different products.

CAse 2:
The above scenario could also be implemented with a single site having multiple products for sale.

For Case 2 one would go for a single database for all the products.
While for CAse 1 ,a separate Database is developed for each Site.


What I fill is CAse2 is a more appropriate choice even if we have multiple sites for different products.

This would help us in rapid development of any ecommerce site...
ANd better ERP management for the Company.

I would appreciate some expert guidelines for the above scenario


Thanx in Advance
Warm Regards
Girija

View 1 Replies View Related

Internalization Of (generic) Application Layer Software To The Database TSQL

Jul 20, 2005

Greetings to all database professionals and laymen,Let us make a bold assumption that we have developed a softwaretool for the SQL Server environment which simply acts as an interfacebetween an end-user in an organization and the database, throughthe exclusive use of stored procedures which are authored by theorganization or by software developers.All development work at the application software level may therebybe conducted within SQL, by the development of TSQL storedprocedures and their coordination across an organization.The question then needs to be asked what are the advantages of thisarrangement and what are the disadvantages. I would appreciateyour comments here, as it is difficult for folk heavily involved (eg: me)in something to obtain objective opinion otherwise.Potentially it is possible to construct an entire database applicationsoftware package using only TSQL stored procedures and thistool. When a database backup is conducted not only the data isbacked up but also all the "program development" suite, in theform of stored procedures (and their scheduling, for example).One of the advantages from my perspective is that this arrangementimplies the possibility that all software external to the database maybe made redundant (except this tool), and along with it, all the otherredundancies of managing application development (life-cycles) withinthe database and then coordinating these changes with softwareexternal the database (particulary loading it to the client environment)You see, I believe that (for example) any and every application writtenin VB, C, etc, etc, etc (external to rdbms) expressly for database software(ie: rdbms software such as SQL Server) involves a redundancy of datadefinitions required ---- once within the VB and once within the db.I would appreciate any feedback on any of the above issues, andwish everyone the compliments of the season.Pete BrownFalls CreekNSWOz~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~EDITOR:BoomerangOutPost: Mountain Man Graphics, Newport Beach, {OZ}Thematic Threading: Publications of Peace and Of Great SoulsWebulous Coordinates: http://www.mountainman.com.auQuoteForTheDay:"Consciousness is never experienced in the plural, only inthe singular. How does the idea of plurality (emphaticallyopposed by the Upanishad writers arise at all? .... theonly possible alternative is simply to keep the immediateexperience that consciousness is a singular of which theplural is unkown; that there *is* only one thing and thatwhat seems to be a plurality is merely a series of differentaspects of this one thing produced by deception (the Indianmaya) - in much the same way Gaurisankar and Mt Everest turnout to be the same peak seen from different valleys."- E. Schrodinger, "What is Life"--------------------------------------------------------------------

View 18 Replies View Related

Designing Database For Jobs Portal

May 27, 2006

Hi...

I am making a online job portal....for dat i need to make a gud database.

wud anybody be kind enuf to provide or tell me how to make a good database design...

thnx..

View 1 Replies View Related

Is There Any Guideline To Reach The 5NF Or Above In Database Designing?

Jul 20, 2005

Dear All,How to reach to the highest level of normalization for database designing?Guide Lines Needed.What will be the characteristics of a database of a completely normalized databae?Check List needed.ThanksSuryaPrakash Patel****************************************** This message was posted via http://www.sqlmonster.com** Report spam or abuse by clicking the following URL:* http://www.sqlmonster.com/Uwe/Abuse...118039e018ee088*****************************************

View 2 Replies View Related

Perfomance Enhancement Through Proper Database Designing

Jul 20, 2005

Dear ReaderI am trying to design a database. How can I make best Judgement that Indexing (which I am trying to fix during Diagram Desingning process)is ok.I am able to identify the best candidate for the indexing.Below is the details I want to understand:AreaZIPCityCountyDistrictState/ProvinceCountryNow I want the data retrival optimization through Index. (you can suggest another idea, also)Entities Area,...., Country have independent tables.Example:Area_TableAreaID (PK)AreaThey have relationship- one to many- if you go from Country to Area.There is one more table:Location_Table (PK)LocationIDAreaIDZIPIDCityIDCountyIDDistrictIDState/ProvinceIDCountryID(Location_ID is further related to the Address of the contact.)GUI has a single form to enter these details.On a save command details in all the tables -Area to Country- (individually) being inserted.& simultaniously Location_Table is also being inserted with the details.Following is the situation of being queried these tables:(1) GUI user can select an Area than the related details of ZIP .., ..., ...upto Country etc. should be loaded automatically (id it is previously stored by the user entry in the database.)(2) Contacts have to be retrived on the basis of Area, ZIP, .....County. (Necessary Groupings are required )Example:If Contacts are queried Country Wise then the Display should beCountry1State1District1County1City1ZIP1Area1Area2ZIP2City2County2District2Country2Please Guide.SuryaPrakash****************************************** This message was posted via http://www.sqlmonster.com** Report spam or abuse by clicking the following URL:* http://www.sqlmonster.com/Uwe/Abuse...0255a1765491f15*****************************************

View 5 Replies View Related

Designing (or Gathering Data From): A Hierarchical Database Using SQL

Feb 18, 2008

Hi All,

I am attempting to create a Visual C++ application based on displaying financial charts and am using SQL Express to store Stock information such as the Exchanges the stocks are traded on, the indicessectors they belong to and the Closing prices for as long as I can download data for. I am not proficient in C++ nor SQL and am using this project to learn both languages as well as making myself rich beyond my wildest dreams.

I have "designed" a database with the following tables:

tblDate_ 1 column clmDate (Primary Key, smalldatetime, NOT NULL)

tblStockExchange_ 4 column clmStockExchangeID (PK, int, NOT NULL)
clmParentID (int, null)
clmStockExchange (nvarchar(50), NOT NULL)
clmMarkets_ (FK, nchar(20), NOT NULL)

tblMarkets_ 1 column clmMarkets (PK, nchar(20), NOT NULL)

tblIndices_ 1 column clmIndices (PK, nchar(50), NOT NULL)

tblSectors_ 1 column clmSectors (PK, nchar(50), NOT NULL)

tblMarkets_Sectors 3 columns clmMarkets_SectorsID(PK, int, NOT NULL)
clmMarkets_ (FK, nchar(20), NOT NULL)
clmSectors_ (FK, nchar(50), NOT NULL)

tblSecurities_ 4 columns clmEPIC (PK, nchar(10), NOT NULL)
clmSecurity_Type (nchar(5), NOT NULL)
clmSecurty_Name (nchar(50), NOT NULL)
clmSectors_ (FK, nchar(50), NOT NULL)

tblSecurities_Indices 3 columns clmSecurities_IndicesID (PK, int, NOT NULL)
clmEPIC_ (FK, nchar(10), NOT NULL)
clmIndices_ (FK, nchar(50), NOT NULL)

tblSecurities_Date_OHLCV 8 columns clmOHLCVID (PK, int, NOT NULL)
clmEPIC_ (FK, nchar(10), NOT NULL)
clmDate_ (FK, smalldatetime, NOT NULL)
clmOpen (float, NOT NULL)
clmHigh (float, NOT NULL)
clmLow (float, NOT NULL)
clmClose (float, NOT NULL)
clmVolume (float, NOT NULL)

Why so many tables? perhaps you should put some more in...


This was the only way I could work out how to store one-to-one and one-to-many relationships required for:

- Many closing prices for many stocks
- Stocks belonging to many indices
- Stocks belonging to only one sector
- Stocks belonging to only one market (MainMarket or AIM for LSE)
- Stocks belonging to only one Exchange (I am aware of dual listed stocks but one thing at a time)

Why nchar's and not nvarchar's?

Because I didn't realise the benefits of nvarchar's until recently. How can I change this a loose the extra spaces in the cells.

Why do some tables have IDs and others don't?

I decided to put ID columns in for tables that didn't have obvious Primary Keys - if someone could explain the advantages if ID columns I would be grateful.

To the SQL Professional's eye there will be some obvious things wrong with this design and your criticism is welcome. The database I have is achieving what I would like it to do; I can plot charts using the data but I have ran into problems when trying to create a TreeView control which is what I would like to use as a navigational tool in my application.

It would seem that pulling hierarchal data from a relational database, to pass to the TreeView control, is a tricky task to say the least. I have found many articles online which discuss how to do this (using an Adjacency List Model or Nested Set Model) but they define a fairly simple example at the beginning (based on fruit or electrical goods) but don't appear to talk about gathering data from an existing relational database or changing an existing relational database so that it is more suited to storing hierarchal information. I have Joe Celko's - Tree and Hierachies in SQL for Smarties but sadly this fine material is a little beyond me!

I would like the hierarchy to look like this:

StockExchange

Market

Sector

Stock
Indices

Sector

Stock

I have written three queries to get the StockExchangeMarketSectorStock information individually from each table but am struggling with ways to put all the rows together, add left and right values (Nested Set Model) then run queries against this to get individual nodes to pass to the TreeView control. Therefore is there something I need to add to the original design?

Any help would be greatly appreciated.

View 4 Replies View Related

Designing A Compact Database For Mobile Device

Apr 4, 2008

Hey guys,

So I started an SQL CE database for use inside a mobile application. I used SSMS to create a .sdf file (because if I let Visual Studio do it, SSMS can't open it because it will be version 3.5).

The reason I wanted to use SSMS is because I wanted to be able to design the database in design view, and populate it with initial information for the application to use. That means adding tables and rows.

The problem is, SSMS doesn't seem to have a design view available when working with CE databases. It also doesn't seem to have a feature for adding rows into tables. It's essentially as useless as VS2008 for designing my mobile database. It only lets me add tables, and I can't even do that visually in design view. I have to use those cumbersome forms.

Is there any way to design a CE database in design view? And add rows of data into tables? It feels like I'm overlooking something.

Note: I dont need to subscribe or publish the database. The mobile application just needs to use the database as a repository.

View 7 Replies View Related

RAM - Generic ? W/ SQL Server

Nov 14, 2000

In general (I know.. lots of factors) but in general will adding more RAM to a SQL box help the performance? I'm working w/ 256MB right now, and deciding whether to add 256MB or 512MB? Any advice

Thanks and sorry so generic but this is a vendored app and they know of design issues but for now that can't be changed.

View 1 Replies View Related

Generic Date

May 26, 2006

Hi guys

I have a simple problem:

I want to be able to query with a start date(@start) and then calculate 1 year from there. I figured since the date is of type integer just add 364 and it will give me the day before 1 year.
So if its 1998-05-01, Id get 1999-04-31.


Code:


DECLARE @FinStart DATETIME
DECLARE @FinEndDATETIME

SET @FinStart = '1998-05-01' --is of type int .:. +365 is adding 1 year
SET @FinEnd = @FinStart + 364

SELECT @FinStart
SELECT @FinEnd



Problem, this doesnt cater for leap years.

Any suggestions?

The help is always appreciated!

Justin

View 2 Replies View Related

A Generic Trigger

Apr 11, 2008

Here's the scenario:
whenever a change (insert/update/delete) has occured in any of the tables, it needs to be logged by adding the changed table's name, and changed columns' names (if any) into the special ChangeLog table.
So, is it possible for me to write a generic trigger that would get the name of the table it just executed upon and names of every column affected by the UPDATE and then insert those into the Log table?
If this is not possible, how do you suggest it should be done?

I'm familiar with standard SQL but T-SQL is completely new to me, so please bear with me if my question makes no sense...

Thanks!

View 1 Replies View Related

Disappear The Generic Bar.

Dec 21, 2006

Hallo all :

How to disappear the generic bar in the report, or to disappear some options (example export). I speak about the bar which in the top of the report or there are the numbers of pages.



Thank's.

View 4 Replies View Related

Dataset To Generic List. How To Do This?

Apr 28, 2007

Hello,I have a DataSet which results from accessing an SQL database.Each row is an Article and has various columns like Title, Description, etc.I have created a Generic List as follows:Dim Articles As Generic.List(Of Article)Article is a class with various properties. Each property is the same as each column in the dataset.I want to fill the Generic List with the data from my DataSet.How can I do this?Thanks,Miguel

View 1 Replies View Related

Generic Stored Procedure

Jun 5, 2004

I have 24 lookup tables that contain the same columns (e.g. Rec_Id (identity field), Code, Desc) and I need to build an interface for each of these tables with Create, Update, and Delete capabilities.

I would like to create three stored procedures (create, update, delete) that would perform the task for any of the lookup tables.

For example, table AGENCY has three fields (Agency_id (identity field), Agency_Code, Agency_Desc) and I need to add a new record to AGENCY. I would like to call a stored procedure that would take the parameters @tablename, @code, @desc, and then create a new record in the table specified by @tablename.

I could then use a single "create" stored procedure for all of the lookup tables when adding a new record, rather than creating a separate "create" stored proc for each of my lookup tables.

Any help would be greatly appreciated!

View 10 Replies View Related

Generic Stored Procedure

May 11, 1999

I am attempting to create a generic stored procedure in SQL Server 6.5 which returns a record count of a specific table passed in as a parameter. The stored procedure looks like this"

CREATE PROCEDURE asp_GetRecordCount
@tablename varchar(30), @recordcount integer OUTPUT
AS
/* Generic stored procedure which returns
number of records in a table.
*/
SELECT @recordcount = COUNT(*) FROM @tablename
RETURN
GO

The problem is that when I save the stored procedure, SQL Server balks at the FROM @tablename entry. Any suggestions? Thanks.

View 3 Replies View Related

Generic Statistics Syntax

May 17, 2006

I have a bunch of tables for my basketball club's d/b. I want to be able to interrogate them to build a web page showing player stats. For example, I want a table showing the top 5 scorers, top 5 3-point scorers, etc. What's got me foxed is how to join it all up and then sort it into the top 5 order. The main tables in question are T_Member, T_Fixture, T_Season and T_FixtureTeam:

T_Member:
MemberNo, FirstName, LastName, (etc)

T_Fixture:
FixtureNo, SeasonNo, MatchDate, (etc)

T_Season:
SeasoNo, SeasonDescription, SeasonStartDate, SeasonEndDate, CurrentSeason

T_FixtureTeam:
FixtureNo, MemberNo, 2Points, 3Points,Fouls,FreeShotAttempts,FreeShotsHit,Assists

Where you see the same field name, that field data is common for all tables that it appears in. In other words, for example, the T_FixtureTeam 'FixtureNo' and 'MemberNo' fields are made up of 'T_Fixture.FixtureNo' and 'T_Member.MemberNo' respectively.

Ready?
The user will select a season at the top of the page (although there's a default to the current season (CurrentSeason is a Boolean field). The query needs to:
- Find all fixtures in that season
- Find all members who played in those fixtures
- Find the top 5 3-point scorers (or whatever stat I'm gathering) for those matches
- Sort the resulting data

I figure I need a JOIN on MemberNo but, as I say, the rest of it has my head spinning.

TIA

View 1 Replies View Related

A Generic Error Occurred In Gdi+

Feb 8, 2006

I'm receiving "a generic error occurred in gdi+" processing error while
running a preview of my report inside visual studio. When this report
is opened by a client, their browser will just hang (Not Responding).

Other reports don't have error. The report will not render any chart although thousands of record will be need to output.

Hope anyone can help. Thanks!

View 5 Replies View Related

Generic Store Procedure

Apr 9, 2008



I have to make a store procedure for every table like
create proc ins_all (@alltable varchar(100),@allfields nvarchar(1024),@allvalues nvarchar(1024))

as
insert into @alltable (@allfields) values (@allvalues)

this procedure generates error, Can anyone give a good idea for the required procedure

Thanks in advance

View 6 Replies View Related

Generic Collation For Unicode

Oct 16, 2007

Hi,

We want our database to be unicode complaint and i need a generic collation that should do the work irrespective of the fact what data is entered in the database. Can someone suggest me any generic collation for that.

Thanks and regards
Salil

View 3 Replies View Related

DbDataReader.NextResult With Generic Lists ?

Jun 20, 2006

 Hey I'm using this DAL to populate a generic list called assetDetailListHowever I'm adding a 2nd result set to my stored proc, protected void GenerateAssetDetails<T>(DbDataReader dataReader, ref List<AssetDetails> assetDetailList)        {            while (dataReader.Read())            {                    // Create a new culture                    AssetDetails assetDetail = new AssetDetails();                    // Set the culture properties                                       assetDetail.FileName = dataReader.GetString(dataReader.GetOrdinal("filename"));                    assetDetail.Title = dataReader.GetString(dataReader.GetOrdinal("title"));                    assetDetail.AltTag = dataReader.GetString(dataReader.GetOrdinal("alt_tag"));                    assetDetailList.Add(assetDetail);                    dataReader.NextResult();// this is the 2nd result set               AssetContent assetContent = new AssetContent();               assetContent.content_id = dataReader.GetInt32(dataReader.GetOrdinal("content_id"));             how do I creatre another  list .Add(assetContent);            }            // Close and dispose of the reader            dataReader.Close();            dataReader.Dispose();        }        #endregion    }

View 2 Replies View Related

Generic Query Designer Disabled

Jul 18, 2007

Hi,



This is really a Visual Studio 2005 Report Designer problem but I didn't see a good place to post this question in the Visual Studion forum.



On some reports when looking at the Data tab the Generic Query Designer is disabled. Anybody know why? The report runs. Other reports have it enabled.



I am using Visual Studio 2005 sp1.



Thanks,

Darren

View 1 Replies View Related

Using Generic Function Through Script Tasks

Apr 25, 2007

Hi everyone,

I€™ve got a few Script Task in my dtsx. Up to the moment I don€™t need have generic functions but I was wondering if it is possible to use a such functions.
I attach you a sample of I say you:

Script Task1
General()

ScriptTask2
Stuff
WritingLog()

ScriptTask3
Stuff
Call General()

Thanks for your thoughts,

View 3 Replies View Related

Generic Query Designer Issue

Jan 10, 2008

Here is my situation. I have a fairly large query that I am working on in visual studio (data tab). I am at the point where the program will NOT let me type (add SQL code) anymore. I found that clicking the Generic Query Designer (turning the query builder on) button switches the format then allows me to add more code. Well, this solves the running out of room issue, BUT now it does something to my code and it will not process it. Prior to clicking the Generic Query Designer button, everything worked w/ no errors. I did not change anything, but simply pressed the Generic Query Designer button (turning the query builder on) and now it dose not work now. Just for kicks, I have pasted my working origional code into SSMS, added code and it executed just fine in SSMS. But then I pasted back into visual studio and it gave me the same errors?

Has anyone experienced this? Is there a maximum for lines of code? Why does the Generic Query Designer (having query builder on) change my code? All comments are welcome!

-Smylie

View 6 Replies View Related

Generic Staging Design Of Data Warehouse

Jan 6, 2006

I have a question about staging design using SSIS. Has anyone come up with an ETL design that would read table names from a generic table and dynamically create the ETL to stage the table.

1. Have a generic table which would have table name and description and whatever else that was required.

2. Have a master ETL that would enumerate through the table and stage all the table names found in the generic table.

This way I wouldn't have to create an ETL which would hardcode the names of 300-500 tables and have the appropriate 300-500 data sources and targets listed.

Not sure if I am making sense but I hope someone understands the attempt.

thanks

View 10 Replies View Related

[SQL SERVER 2000] Generic Table Exporter

Jun 28, 2007

Hello every body.
First of all sorry for my bad english but I'm french ;-)

My internship consits into making a generic table exporter (with a table list). Export into csv files.

I have tried 2 solutions :
1 - Create a DTS with a Dynamic Properties Task. The problem is I can easily change the destination file but when I change the table source I don't know how to remap the transformations between source and destination (do you see what I mean ?). Any idea ?

2 - Use the bcp command. Very simple but how to do when tables contains the separator caracter ? for example : If a table line is "toto" | "I am , very happy" --> the csv file will look like this : toto, I am , very happy --> problem to get back the data ( to much comma ).
Does someone has a solution ?

Last point is how to export the table structure ? For the moment, using the table structure, I generate an sql query which creates a table (I write this query in a file). Isn't there any "cleaner" solution ?

Thanks in advance and have a nice day all

View 3 Replies View Related

Generic Concatenator As A User-defined Function

Feb 26, 2008

Hi-

I have a number of tables that contain data that we want to concatenate as a part of our reporting processes. Instead of building a whole series of functions that each concatenate data from only one table, I want to create a function (or functions that work together) to concatenate data from ANY specified table, since the logic is identical.
The basic logic is:




Code Snippet
DECLARE @x varchar(max)
DECLARE @theReturn varchar(max)
DECLARE theValues CURSOR FOR
SELECT DISTINCT TOP 100 PERCENT <col name to concatenate>
FROM <the table in question>
WHERE <the identity column in the table> = <a specific value>
ORDER BY <col name to concatenate>
SET @x = ''
SET @theReturn = ''
OPEN theValues
FETCH NEXT FROM theValues INTO @x
WHILE @@FETCH_STATUS = 0
BEGIN
SET @theReturn = @theReturn + '; ' + @x
FETCH NEXT FROM theValues INTO @x
END
CLOSE theValues
DEALLOCATE theValues
SET @theReturn = LEFT(@theReturn, Len(@theReturn) - 2)
RETURN @theReturn



The problem I am running into is how to create the "generic" or "abstract" version of the SELECT statement in the cursor. I can certainly pass in the values surrounded by < and > as arguments, but I cannot figure out how to insert them into the SQL and make it work. I can't create a text string and then use the EXEC statement, because in a scalar function SQL Server won't allow it.

Any thoughts, work-arounds, or solutions?

Thanks-

View 5 Replies View Related

Stored Procedure Addressing Generic Table

Oct 20, 2006

I want to use ONE stored procedure to update/insert about 300 tables in a database. I hoped this code would work but it gives me an error:

ALTER PROCEDURE [dbo].[InsertRowsTick]
@tableName varchar,
@bid float,
@ask float,
@last float,
@volume int,
@dateTimed DateTime
AS
BEGIN
SET NOCOUNT ON;
INSERT INTO tableName (
bid,
ask,
last,
volume,
dateTimed)
Values (
@bid,
@ask,
@last,
@volume,
@dateTimed)
END

When I (1) commented out @tableName parameter and (2) instead of INSERT INTO tableName wrote: INSERT INTO <realtableName> the code (C#) executed and the table was filled.

How can I use a generic table name as a parameter?

Thanks.

View 9 Replies View Related







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