AlaSQL saved database location - alasql

Where can I find the locations that are made from alasql? For example
alasql('CREATE TABLE one (two INT)');
Where is table one will be saved?

The table one will be saved in the global variable alasql.tables.one.
The data you put into the table one will be located in the global variable alasql.tables.one.data.

Related

Get the table name as dynamically in ssis

I have a table in that table i'm inserting all my TableNames of that database.
Now I need to pass this table name to OLEDB source DYNAMICALLY from my main table one by one
Is this possible to to pass the table name as dynamically in OLEDB source.
I suspect you are then going to run some SQL against the stored table name?
You'll need to approach this differently and run what you are trying within a SQL task.
If not, give us some more information about exactly what you are trying to achieve.

How to add same object type as different tables in same realm?

I'm using realm to cache certain network data coming down which is specific to the last search. I'd also like to be able to star or pin this data to save it for future usage. The data objects are exactly the same and I can't find anything in the documentation that allows me to save them in separate tables in Realm.
The easiest way to go about doing this would be to simply create a subclass of your model object with a different name (e.g., MyDataObject and its subclass MySavedDataObject). This will create a new table in the Realm database file with the same schema and will let you distinguish between the two types of objects.
You can then create a copy of a normal object as a saved object as simply as the following:
let myNewSavedObject = MySavedDataObject(value: myDataObject)
That all being said, instead of duplicating data, I would personally recommend being a bit more efficient with the existing data set. Surely simply adding an additional boolean property to the schema named something like saved would let you simply mark objects that you wish to keep without needing a whole second table. :)

Load File using Entity Framework

Right now I have file upload/download through Entity Framework working but I see an issue coming up. In the scenario when i want to get a list of all the files associated with a record, I don't want it to pull the Data property, just the FileId and Name, because the files can be up to 10MB each.
I have LazyLoading disabled so I'm thinking about putting the Data column into another table and only load the data when I want. That way I can just supply a link to a controller with the FileId I want to download. But maybe there is a better way? All suggestions are appreciated. Thanks!
My File entity has the following properties:
FileId
FkRecord
Name
Data
you do not need to put data column in another table - just create another entity in the designer and move you [Data] column in it. don't forget to create corresponding table mapping in designer - map you data column to the column in db table.
Also create 1 to 1 association between entities. And you could use navigational properties and do not need to alter you db table!
I found similar discussion:
Can I lazy load scalar properties with the ADO.Net Entity Framework?

EF Code First - Entity joining multiple tables

I currently have an EF class that is backed by a database view (joining multiple tables). To make it updatable, I need to change the class to be backed by a database table. I am using Entity Framework 4.1 Code First and can't figure out how to set up those relationships?
To simplify, I currently have a Categories class that returns the Category Name (Categories table) and Category Type Name (CategoryTypes table). These are both in the database view that I currently use. I want to change to a ViewModel that brings back both of these fields directly from their tables and joins properly, that way when a user updates a Category Name, EF should be able to properly handle the update (since it will be updating the table instead of the view). Any tips on how to do this?
Table is a table - it is a single database object. If you want to remove your view and replace it with a table you need to delete your current tables (Categories and CategoryTypes) and create a single table which will contain denormalized data. That is pretty bad solution and it will cause you problems in the whole application.
Just to simplify description: It is not possible to replace your view constructed by joins among several tables with a table and it is not possible to make your view updatable.
You are doing it wrong because you are obviously mapping view models directly to your database. Map Catagories and CategoryTypes to entities load Category with its CategoryType and flatten them to your view model in your application logic (or load the view model through projection). Once user updates your view model decompose it back to separate entities and save them.

Stored procedure temporary table problem?

I am using stored procedure to extract data from two different databases to a ASP.NET application. My stored procedure work as follows
- Check if global temporary table exist or not say ##temp_table
- if exist then drop it and if not create new temporary table say ##temp_table
- Extract data from two different databases and fill it to Temporary table
- Select data from temporary table
- Drop temporary table
Now problem is that when number of users accessing the same page with same stored procedure as above then to some users it get error that temporary table already exist.
Now please some one help me to solve such problem or suggest me some alternate because I don't want to write query in side ASP code. Some one suggest me to use views. Waiting for your suggestions.
"##" tables are accessible by all connections to the SQL instance, while "#" tables are accessible only by the connection that created them. The functionality you are describing sounds like you should be using "#" tables, not "##" tables.
You must not create table, you must declare variable for temporary table storage...with the column you expect to fill out...declare table variable like this:
declare #tmpTable table(myID int,myName varchar(50));
fill it like
insert into #tmpTable
Select * from table1
use it like
select * from #tmpTable

Resources