Changing Timeframes With Stock Data
Apr 21, 2006
I have stock data in 1 min intervals and would like to convert it into other timeframes (e.g., 10 min, daily, monthly).
Here's is some sample data and my final goal:
[DateTime] [Open] [High] [Low] [Close] [Volume]
10-Feb-05 12:10:00 3.88 3.88 3.87 3.87 10
10-Feb-05 12:11:00 3.87 3.87 3.87 3.87 2
10-Feb-05 12:12:00 3.86 3.86 3.86 3.86 1
10-Feb-05 12:13:00 3.85 3.87 3.84 3.85 23
10-Feb-05 12:14:00 3.85 3.85 3.85 3.85 6
10-Feb-05 12:15:00 3.86 3.86 3.86 3.86 1
10-Feb-05 12:16:00 3.85 3.85 3.85 3.85 1
10-Feb-05 12:18:00 3.85 3.85 3.85 3.85 3
10-Feb-05 12:19:00 3.85 3.85 3.85 3.85 3
[DateTime] [Open] [High] [Low] [Close] [Volume]
10-Feb-05 12:10:00 3.88 3.88 3.84 3.85 50 *
*sum
View 8 Replies
ADVERTISEMENT
Sep 11, 2007
helo all...,i want to make procedure like:examplei have table: item (itemid,itemname,stock)orderdetail(no_order,itemid,quantity)itemmoment(itemid,itemname,stock)item table itemid itemname stock c1 coconut 2 p1 peanut 2orderdetail tableno_order itemid quantity 1 c1 5itemmoment tableitemid itemname stock c1 coconut 0 p1 peanut 0 when customer paid, his quantity in orderdetail decrease stock in item table..so stock in item table became:itemid itemname stock c1 coconut -3 p1 peanut 2it's not good, because stock may not minus...so i want to move -3 to itemmoment table..so stock in item table became:itemid itemname stock c1 coconut 0 p1 peanut 2and in itemmoment table became:itemid itemname stock c1 coconut 3 p1 peanut 0my store procedure like:ALTER PROCEDURE [dbo].[orders]( @no_order as integer, @itemid AS varchar(50), @quantity AS INT)ASBEGIN BEGIN TRANSACTION DECLARE @currentStock AS INT SET @currentStock = (SELECT [Stok] FROM [item] WHERE [itemid] = @itemid) UPDATE [item] SET [Stock] = @currentStock - @quantity WHERE [itemid] = @itemid COMMIT TRANSACTIONENDit's only decrease stock with quantity. i want move stock minus from item to itemmoment..can anyone add code to my store procedure?plss.. helpp.thxx....
View 2 Replies
View Related
Feb 21, 2008
Hello,
I have requirement to cache report server as soon as data get refreshed in datbase.My database get refreshed every 10 minutes.
I am working in stock and bond domain were data changes very frequently.My user want to see almost live data whenever accessing report in report manager.they also want to cache some data for better performance.Can any one tell me step's to improve performance of reporting services .
Kindly suggest me.
Thanks.
Monika Singh
View 11 Replies
View Related
Sep 7, 2006
Everything I've read says that custom data flow components are built by inheriting from the Microsoft.SqlServer.Dts.Pipeline.PipelineComponent class.
But the stock components such as the Derived Column data flow transformation must each be implemented by their own class. So how do I base my custom components on those classes? The documentation for the PipelineComponent class doesn't list any such subclasses.
View 1 Replies
View Related
Dec 3, 2006
I am working on a stock price analysis project. Stock prices are stored in SQL Server as tick by tick data (that means in a high frequency) and need to be grouped by minutes in order to display them as as high, low, open and close prices in a candlestick or similar chart.
The fields in the table are:
Time (for every stock price tick)
Price (stock price)
Symbol (of the stock)
A sample time series would look like this:
11:45:01 $22.11 MSFT
11:45:02 $22.10 MSFT
11:45:04 $22.25 MSFT
...
...
...
11:45:58 $22.45 MSFT
11:46:03 $22.22 MSFT
11:46:08 $22.25 MSFT
...
...
...
11:46:59 $22.45 MSFT
The result of the SQL query should be:
Symbol Time Open High Low Close
MSFT 11:45 $22.11 $22.45 $22.10 $22.45
MSFT 11:46 $22.22 $22.45 $22.22 $22.45
This is the SQL statement I came up with but obviously doesn't work:
SELECT DATEPART(Minute,Time), MIN(Price), MAX(Price) FROM dbo.TimeSales WHERE Symbol='MSFT' GROUP BY DATEPART(Minute,Time)
I would appreciate any suggestions.
Thank you!
View 10 Replies
View Related
Feb 28, 2008
Hi, all experts here,
Do we always have to use SCD component for the loading of data into data warehouse to handle changes of rows?
I am looking forward to hearing from you and thank you very much in advance for your help.
With best regards,
View 4 Replies
View Related
Mar 4, 2007
Hi all, i don't know where to post these, and so i posted in here about sql stuff... I want to do a stock inventory for my restaurant, and i don't know how to start building the database, so, I want to ask if anyone knows if they have a database diagram for stock inventory... any kind of database diagram will helps, so I get and Idea how to start... thanks...
View 2 Replies
View Related
Jun 17, 2008
Well probably not that complex for some of you out there!
I need to work out the amount of stock which was sold between @datefrom and @dateto and how much we currently have on hand (to work out if we are over ordering etc). That's the pretty easy part but I also need to include a column which works out how many items have been sold 3 months prior to @datefrom (from invoiceline). The proc I have so far works out the items sold between 2 dates so basically what I need is another column which is the amount sold (QtySold) in the 3 months prior to datefrom
This is the basic part I have so far:
ALTER PROCEDURE [dbo].[rptstockholdinglevel]
-- Add the parameters for the stored procedure here
@datefrom datetime,
@dateto datetime,
@periodname varchar(50),
@percentage int
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
-- Insert statements for procedure here
SELECT
products.productname,
@periodname AS periodname,
isnull(SUM(invoiceline.qty),0) AS QtySold,
products.qtyonhand AS OnHand,
nominals.nominalname,
productcategories.categoryname,
productmanufacturers.manufacturername
FROM
productmanufacturers RIGHT OUTER JOIN
invoices INNER JOIN
invoiceline ON invoices.invoiceid = invoiceline.invoiceid RIGHT OUTER JOIN
products ON invoiceline.productid = products.productid ON productmanufacturers.manufacturerid = products.manufacturerid LEFT OUTER JOIN
nominals INNER JOIN
productcategories ON nominals.nominalid = productcategories.salesnominal ON products.categoryid = productcategories.productcategoryid
WHERE
(invoices.invoicedate BETWEEN @datefrom AND @dateto)
OR
(invoices.invoicedate is null)
GROUP BY
products.productname,
products.qtyonhand,
productcategories.categoryname,
nominals.nominalname,
productmanufacturers.manufacturername
HAVING (SUM(isnull(invoiceline.qty,0)) < products.qtyonhand)
ORDER BY
nominals.nominalname,
productcategories.categoryname,
productmanufacturers.manufacturername
END
I'd be really grateful for any pointers as I'm just going round in circles on this one.
Thanks in advance as usual all :)
Stephen.
View 6 Replies
View Related
May 7, 2007
hello,I have a table like this:thing, size, color, type_mov, vary1, s, red, sell, 11, s, red, buy, 21, m, green, return, 10....and the question is how I can see the total number of products by sizeand color having in mind that some type of movement are + and otherare -.in other words, like stock control.how I can control this in sql server?code, procedures?thanks!
View 2 Replies
View Related
Apr 16, 2014
I have an source file and i have to load it into the data base by changing datatype of the columns in ssis
View 1 Replies
View Related
Oct 3, 2007
I have a fairly simple data flow task that loads data from one table (OLE DB Source) into another table (OLE DB Destination). The data type for one of the pairs of columns is nVarChar(120) and it contains version information that looks like a decimal. When I run the export, the destination has a trailing zero added after the decimal point as if it were a numeric column which invalidates our comparisons (string 1.0 is not the same as string 1.00). There is no cast or convert done to this column, it is a straight copy. Any ideas what could be causing this or how to fix?
View 6 Replies
View Related
Aug 29, 2006
I have created a SSIS package that transfer data from a Foxpro database to an instance of SQL Server 2005 Express. I used the wizard to create the package but I load and execute the package within a custom application that I have written in C#.
The way the custom application is intended to work is that the user can have the database in any location on the computer and all he has to do is specify the location then the application programatically changes the location of the source on the package that it has loaded and then execute it. When I initially run the package the first time (using the original path), it works fine and transfers the data. However, every subsequent time I run the application and specify a different path, the database on the SQL Server side gets created as expected but the data is not transfered!
Where am I going wrong? Do I need to save the package after I modify the source then reload and run it again or do i need to change something else in the Data Flow to make this work?
View 4 Replies
View Related
Sep 3, 2007
helo alll...,this is my data:my table is item(productid,stock) ,order(customerid,no_order), and orderdetail (no_order,productid,quantity) example: order and orderdetail displayed in gridview....order is displayed like this: customerid no_orderdetail A 1detail B 2 when i click detail in row 2, it's display orderdetail:no_order productid quantity 2 c1 2 2 p1 3 i have make all this is ok. but i want to decrease stok in item with quantity in orderdetail.my code in procedure like:CREATE PROCEDURE [dbo].[order_item](@productid AS varchar,@quantity AS INT)ASBEGINBEGIN TRANSACTIONDECLARE @no_order AS INTDECLARE @stock AS INTINSERT INTO [Orderdetail]([ProductId],[Quantity])VALUES(@productId,@quantity)SET @no_order = SCOPE_IDENTITY()SET @Stock = (SELECT [Stock] FROM [item] WHERE [ProductId] = @productId)UPDATE [item]SET[Stock] = @Stock - @quantityWHERE[ProductId] = @productIdCOMMIT TRANSACTIONENDreturn it can't work..how about his true code in store procedure?ok..., thx..
View 8 Replies
View Related
Jan 22, 2007
Hello..
I am designing a Database Application that covers Inventory System. And I am now in a dilemma of chosing which design to track Inventory stock better, in performance, reliability, and error free?
1st Design
PRODUCT TABLE
ItemID
ItemName
Price
QtyOnHand
..and other unique info of the product..
SALES TABLE
SalesID
Date
...etc...
SALESDETAIL TABLE
SalesID
ItemID
QtySold
Price
PURCHASE TABLE
PurchaseID
Date
...etc...
PURCHASEDETAIL TABLE
PurchaseID
ItemID
QtyPurchase
Price
...etc...
and similar design with SALESRETURN+DETAIL, PURCHASERETURN+DETAIL, ADJUSTMENT+DETAIL
Tracking Inventory stock is done by using (update, insert and delete) triggers in each of the DETAILS to update the QtyOnHand in the PRODUCT TABLE
2nd Design
PRODUCT TABLE
ItemID
ItemName
Price
...etc...
INVENTORY TABLE
ItemID
QtyBegin
...etc...
SALES TABLE
SalesID
Date
...etc...
SALESDETAIL TABLE
SalesID
ItemID
QtySold
Price
...etc...
and similar design with PURCHASE+DETAIL, SALESRETURN+DETAIL, PURCHASERETURN+DETAIL, ADJUSTMENT+DETAIL
The later design does not hold QtyOnHand, but only save QtyBegin instead. To get the QtyOnHand, it uses views/stored procedure with Union Query, so it looks like this:
QtyOnHand = QtyBegin + Sum(QtySold) + Sum(QtyPurchase) + Sum(QtySalesReturn) + ........
And at the end of a accounting period, the calculation of the QtyOnHand will be the QtyBegin of the next accounting period.
According to you guys, which way is better in PERFORMANCE, RELIABILITY, ERROR FREE, and why? What are the pros and cons of these two?
Thanks a lot.
View 3 Replies
View Related
Oct 8, 2015
I have the following store procedure :
SELECT APHIST.ReturnDate AS ATDATE
,API_HIST.[ActionPlanItemID]
,API_HIST.[ActionPlanID]
,PIT.[ProductItemID]
,PIT.ProductItemCode
,PIT.Name,
[code]....
What I am trying to get is a RunningStock level column which is able to display stock level as describe below :
If ItemStatus value is 0, that means that the item has been taken out from stock.
So based on that the first row running Stock level is calclulated as
(ProductQuantity * ItemUnitWeight)-ItemQuantity=9...
For the second record, ItemsStatus=1 which means the item return to stock, at the time the running stock value calculation should be the previous row Running Stok value (=9 ) +(ItemQuantity*ItemUnitWeight)When the ItemStatus=2, that means the item is definitely out and will be never back to current stock. Is there a way to get that calculation field ?
View 6 Replies
View Related
Mar 13, 2007
I would like to use analysis services to analyze stock prices.
I want to find conditional probabilities:
P (YpriceChg >= 10% s.t. Ydate between A and B| X Price Chg >= 20%)?
€¦ Like given a price change of X percent or greater, predict the probability of a price change of Y percent or greater, within a specified time window (like 2 days, 3 months etc.).
I also want to add a support filter, like:
N > 30 cases (i.e., there have been at least 10 instances of a 10% or greater price change, for the chosen time window)
I have a database of prices, monthly, daily, etc. I also have a number of cols that compute statistics such as pChg1M, pChg-1M, vChg1d. Like price chg 1 month forward, price change 1 month backward, volumeChg1d forward. Ideally, I would like to minimize the column flags necessary for the experiment. Can you offer some hints, as far as setting up appropriate columns/flags and choosing a algorithm (maybe decision trees, association rules, or NB)?
View 1 Replies
View Related
Oct 4, 2007
hi allin the sample of sqlserver2005(notification service(stock))this is code sample in :appADF.xml(stock) -------------------------- -- Update value in the chronicle if event price greater than value in the chronicle UPDATE StockEventsChron SET StockPrice = E.StockPrice FROM StockEvents E, StockEventsChron C WHERE E.StockSymbol = C.StockSymbol AND E.StockPrice > C.StockPrice.for scenario: + the first SubscriberId(Stephanie) set :StockTriggerValue=20, and stockPrice changge =50 -> one notification for Stephanie and in the table StockEventsChron the value field :StockPrice = 50, + the next : stockPrice changge = 25. the field value StockPrice of table StockEventsChron is still 50 + then second SubscriberId(Scott) set StockTriggerValue=30 but---------------- Insert Into StockNotifications ( S.SubscriberId, S.DeviceName, S.SubscriberLocale, E.StockSymbol, E.StockPrice ) SELECT S.SubscriberId, S.DeviceName, S.SubscriberLocale, E.StockSymbol, E.StockPrice FROM StockSubscriptions S JOIN StockEvents E ON S.StockSymbol = E.StockSymbol LEFT OUTER JOIN StockEventsChron c ON S.StockSymbol = c.StockSymbol WHERE S.StockTriggerValue <= E.StockPrice AND (S.StockTriggerValue > c.StockPrice OR c.StockPrice IS NULL) here :StockTriggerValue=30 < c.StockPrice=50 so no notification for Scott, why ?can anyone help me?
View 1 Replies
View Related
Jan 9, 2001
Okay, here's an algorithm question for you TSQL gurus out there...
Due to circumstances beyond our control, our group has been tasked with a massive project and a very short timeline. And of course, timely completion is needed because our STOCK OPTIONS grants depend on this! And of course board meetings are always scheduled sooner than you expect.
Here's one of the killer questions we're trying to solve...
Given a table of employee ID's, associated supervisor ID's, and the amount of stock options given, how would you write a stored procedure to return, for any branch of the organizational tree, the sum of all the stock options in a particular branch?
Example:
EMPID SUPERVISORID STOCKOPTIONS
1 2 100
2 30 500
3 2 150
30 50 1000
50 60 5000
What we need is something like : "sp_StockOptionsPerDepartment @SUPERVISORID=30"
with a result : "1750".
Basically we're building an organizational chart of our company from this table, on the fly, and also counting up for certain branches of the org chart, the total stock options.
If a manager has two managers under him, and each sub-manager has three employees, then we want to know the total stock options that all 3+3+2+1 = 9 people possess. Basically it's the total pool of stock options for a department, or work group, or division, etc.
Got this to work for a small set of employees, but when we begin to scale up to entire departments, the query times out because it takes tooooo long...
Any ideas? ANY ideas at ALL would be helpful...
Comments
(1) This is basically a tree-traversal algorithm, but conversion into SQL is not always so straightforward. Starting from an arbitrary root node, we must visit every child node underneath, walking all the way down to the leaves.
(2) We tried a brute force algorithm which is fast for smaller sets, but impossibly long for sets where we're dealing with hundreds of employees. Any cheats? Caching results as we go? Any ideas out there?
Thanks,
Dan
dantan@pobox.com
View 6 Replies
View Related
Dec 30, 2011
Assume you have a table called Tick with 2 columns
(
tickId bigint IDENTITY(1,1)
, price int -- usually money data type, making it int for simplicity
)
I am tasked with creating bars that are 10 units long.
Now the catch is I'm not looking for the tickId where price is >= t1(price) + 10 where t1(price) is the price for the first row where tickId = 1. (it could also be where price <= t1(price) - 10)
Here is sample data:
1, 25
2, 26
3, 23
4, 26
5, 27
6, 30
7, 34
8, 32
9, 30
10, 33
What I am looking for are rows 3 (23) and 7 (34)
Currently I have:
Code:
DECLARE @tickDiff int
SET @tickDiff = 10
DECLARE @r1TickId bigint
[Code].....
This seems to work but it is taking multiple minutes to run for about 50k rows of data (which I created off of the 24 million row table I have just looking at data from today). So it takes ~5 minutes to create the first bar which is not acceptible.
If my logic above seems acceptable are there any indexes you could recommend. Database engine tuning advisor didn't find any.
View 2 Replies
View Related
Dec 11, 2014
I have been asked to report on missing Stock in my works Warehouses. My work uses SAP Business One for ERP, and Accellos for Warehouse Management. Both SAP / Accellos maintain stock levels, and whilst they do talk to each other (in real time), nothing is perfect and stock counts (within each system) sometimes develop discrepancies.
Here is the code that I developed to show stock discrepancies -
Code:
SELECT
Tx.[Item Code]
, ISNULL(Ty.Qty, 0) AS 'A1 Qty'
[Code]....
View 1 Replies
View Related
Sep 10, 2014
I need to create query for last stock quantity.
I have 3 tables. Stores, Dates and Transactions. I want to combine all Stores with all Dates in one table and then calculate Last Stock Quantity.
Stores
London
Paris
Prague
Dates
1.1.2014
2.1.2014
3.1.2014
Transactions
1.1.2014 London 1000
1.1.2014 Paris 1300
1.1.2014 Prague 1500
2.1.2014 London 800
3.1.2014 Prague 1200
And result should look like this Last_Quantity should be Quantity for last date in Transactions table.
1.1.2014 London 1000
1.1.2014 Paris 1300
1.1.2014 Prague 1500
2.1.2014 London 800
2.1.2014 Paris 1300
2.1.2014 Prague 1500
3.1.2014 London 800
3.1.2014 Paris 1300
3.1.2014 Prague 1200
View 8 Replies
View Related
Oct 23, 2015
I am struggling with the Lastdate function. I have got stock balance data and want to show the number of products/models that are on stock at the latest date of the stock balance table.
My DAX formula is as follows:
=CALCULATE(DISTINCTCOUNT('3S-StockData'[Article Model]);LASTDATE('3S-StockData'[Date]))
I get the wanted results for all aggregated product groups, on product/model level however the formula does not give me the information wanted (see screenshot).
Basically, the formula calculates correct, but I want in my example only models shown with the date 2015-10-21.
View 2 Replies
View Related
Jan 22, 2014
I worked with someone else to create a query that gives us the age of a stock. How long it has been in the warehouse since the Purchase order date (without completely selling out). It does exactly what I want, the problem is that it only accepts 1 row as a result.
The error message I get is:
quote:Msg 512, Level 16, State 1, Line 4
Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.
So my question is; can this code be modified to pass it multiple SKUS and run a report on every item currently in stock?
SELECT TOP 1
@skuVar, CAST(GETDATE()-ReceivedOn AS INT) AS 'Age'
FROM
(SELECT pir.id AS id,aggregateQty AS aggregateQty,-qtyreceived as qtyreceived, (aggregateQty - qtyreceived) AS Diff, ReceivedOn AS ReceivedOn
,(
SELECT SUM (PurchaseItemReceive.qtyreceived)
FROM bvc_product pp
[code].....
I use Microsoft SQL 2008
View 1 Replies
View Related
Dec 11, 2007
Im making a shopping cart website for a school project in ASP.net with VB. I need help subtracting the quantity purchased (its saved in a session) from the stock number saved in a database.I know this:UPDATE inventory SET stock = stock - <quantity_purchased> WHERE id = <inventory_id>But I dont understand how to get the quantity purchased from the session to <quantity_purchased>. I tried putting the name of the session there and I got an error, i tried saving the session into a dim didnt work either.
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
SelectCommand="SELECT [stock] FROM [product]" InsertCommand="INSERT INTO [product] ([stock]) VALUES (@stock)" UpdateCommand="UPDATE product SET stock = (stock - @Quantity) WHERE (productID = @productID)">
<InsertParameters>
<asp:Parameter Name="stock" Type="Int16" />
</InsertParameters>
<UpdateParameters>
<asp:SessionParameter Name="Quantity" SessionField="Quantity" Type="Int32" />
<asp:SessionParameter Name="productID" SessionField="productID" Type="Int32" />
</UpdateParameters>
</asp:SqlDataSource>
and I have than in my VB code on submit : SqlDataSource1.Update()
View 1 Replies
View Related
Sep 15, 2006
Hi,
I am having problem in getting result out of two table, one table is Item Mater which stores global items for all offices and other is stock file which stores office wise stock items as follows:
ITEM MASTER
--------------
NCODE ITEMNAME
1 A
2 B
3 C
4 D
5 E
STOCKDETAILS
-----------------------------------
NCODE ITEMCODE OFFICEID
1 1 1
2 2 1
3 3 1
4 1 2
5 2 2
6 4 2
7 5 3
I want office wise stock details which inludes items found in stock file and remaining itmes from item master. example for office 1
--------------------------------------------
FOR OFFICE - 1
--------------------------------------------
ITEMCODE ITEMNAME OFFICEID
--------------------------------------------
1 A 1
2 B 1
3 C 1
4 D NULL
5 E NULL
i want a single view from which i can select data like i shown above, any kind of help is highly appriciated, what i tried is , i created union of both tables and tried to get data out of union view but result is not up to desire.
Thanks in advance
View 8 Replies
View Related
Jan 18, 2015
I want to calculate stock aging (qty, cost) based on the on hand quantity.
Currently I am recording only in/out transaction only.
For ex: Item A i have 115 pieces (Balance stock) as on to day.
Transaction History
---------------------
Lot 1 - 01/01/2015 - 50
Lot 2 - 10/02/2015 - 50
Lot 3 - 11/03/2015 - 50
Lot 4 - 15/04/2014 - 50
I want to calculate cost of balance qty as shown below.
Jan -
Feb - 15 @ 1.1
Mar - 50 @ 0.90
Apr - 50 @ 1.2
Database schema
--------------------
CREATE TABLE [dbo].[StockManagement](
[Uniid] [int] IDENTITY(1,1) NOT NULL,
[StockCode] [int] NULL,
[TransactionDate] [datetime] NULL,
[TransactionTime] [time](0) NULL,
[Code] .....
View 0 Replies
View Related
Jul 20, 2005
First of all I am not familiar with SQL so bear with me.I have a field called stock_code, the data in that field, looks likethis000000851. I need to replace only the first two charachters '00' with'DR'.If I use the replace function, it will of course replace everyoccurance of 00 which I dont want.Apart from exporting the data out to excel and changing it thereThanksAlan
View 3 Replies
View Related
Oct 17, 2002
Please HELP!
I need to UPDATE a column by removing only the first occurance of $$sp;. I use the following to get an idea of what I have:
SELECT Reporting_Title_Html FROM Lab_Test Where RTRIM(Reporting_Title_Html)='$$sp;'
Reporting_Title_Html
------------------------------
$$sp;
$$sp;
$$sp;
$$sp;
$$sp;Thyroid maintenance required;$$sp..........
Get 5 Records....One record has multiple occurances of $$sp throughout the Reporting_Title_Html column.
I thought I could do:
Update Lab_Test Set Reporting_Title_Html=' ' Where RTRIM(Reporting_Title_Html)='$$sp;'
But I can't lose the trailing data from record #5. This is just a small sampling of what I'm trying to fix.
Any Ideas???
I've thought about REPLACE but that would replace all the $$sp's and I only want to change the very first one from $$sp to ' ' --> blank
View 1 Replies
View Related
Dec 27, 2006
How do I go from a text data type to a numeric data type without having to delete the column and put it back out there. I tried to changed the data type but it gave me a error saying that I couldn't go from text to int data type. Help.
View 4 Replies
View Related
Sep 4, 2007
Hi All,I have a varchar(255) column for storing text in english and inhebrew.It was a stupid mistake to set the data type to be varchar, becausenow I need to store text in german and francais too.Question: Is it safe to change the data type from varchar to nvarchar,without damaging the data that's already present?(I have more than 1000000 records stored...)Thanks,Danny
View 4 Replies
View Related
Nov 13, 2007
Hello,
I'm working on a distributed application which requires data from a central database to be shown to various users. In particular users should be able to open "views" on the database, specifying the data they are interested in, and being shown the result.
This can be easily accomplished modeling the view specifications as SQL select queries, sending those queries to the server, and visualizing the result. This approach is very flexible, supported, fast and definitely the way we would like to implement it.
The problem is that we have an additional requirement.
In general the data the users might be interested in is not static, and when that data changes, those changes should be propagated to the client views.
There are lots of solutions and technologies aimed to solve very similar problems, but no one seems to support this scenario well.
1. You can re-run the queries every x time (polling)... but this is hardly an option when you have hundreds of client-views that require data to be updated in real-time (so "x time" should be, say, 1 second).
2. You can use query notification... but the documentation explicitily says it doesn't scale well and shouldn't be used with a large number of clients (which is exactly what is needed in this case).
3. You can use replication services... but this technology doesn't really seem to be created to support this scenario.
4. You can use notification services... but even this technology seems to be focused on different scenarios. I haven't looked at it extensively anyway.
5. You can use DML triggers to track data changes... but you still don't have the publish-subscribe mechanism to register client views and the mechanism to know which client views are affected by the changes.
6. You can implement a business logic tier that relates modification requests to client views... and basically do everything from scratch without using existing services.
What are your opinions?
Thank you,
Lorenzo Castelli
View 2 Replies
View Related
May 21, 2006
Use databases a bit, but new to SQL Server. We just want to change a column of existing SQL Server 2005 data from a string data type to one of the UNiCODE data types, such as DT_WSTR or DT.NTEXT (such as one can use for various data mining tasks, etc.). It seems to do this one needs to "the data conversion transformation editor". To use that one has to have a package and a project?
Does any one have a full script or set of steps to do the full set of steps for what should be a simple task? This would be a great example for BOL, but each atomistic bit of BOL refers to another, and one gets lost in the circle when a complete example is needed for fundamantal housekeeping tasks.
View 6 Replies
View Related
Sep 23, 2015
If I have an ACID-based SQL engine and I run a long-running transaction that changes a record at some point during the transaction, and at the same time it's running another transaction changes a record that the long running transaction has/will change/d, will they both complete or will one transaction fail? If they both complete who wins the final state of the record? The long running one or the other one? (is it based on when the transaction actually started "point in time" or is it specific to when the record was changed during the transaction "point in time"?)
View 5 Replies
View Related