Storing Bit Patterns

Feb 21, 2007

hi all,
   what sql data type should i use to store variable length bit patterns no longer than 30 bits?
 

 

View 4 Replies


ADVERTISEMENT

Design Patterns For SQL

Feb 13, 2008


Design patterns are indispensable to improve the quality and productivity of system under development. Even though there are books available addressing the needs of object oriented programming, but useful information for SQL design patterns are hard to find.

I would appreciate if you could share any of the resources that you may have come across.

View 21 Replies View Related

Patterns For Table Design

May 9, 2006

I am looking for something similar to patterns for table design, but I have been unable to find anything on that, or good rule of thumb performance guides for table design.

Most of the situations we face look like perfect candidates for patterns, and some good rules of thumb -- problems like scalable OLAP requirements PLUS real time reporting.

I am looking for several differnet approaches and a good summary of the trade-offs for each one.



Thanks!

View 1 Replies View Related

Find Junk Patterns In Employee Name

Jul 6, 2012

string starts with 3 digit same number
111 H,777GGG,9999 H etc

string starts with NULL

string that starts with sequential digits
123g,897 k

string that starts with sequential alphabets
abcmki12, ghimkkk, rst123 5 etc

string only one character (digit or letter)

string only has same character repeated 3 times except for OOO

string only has three characters, 1 digit and two letters or 2 digit one letter

string that has only two characters one digit and one letter

View 1 Replies View Related

Table Design For Recurrence Patterns

Oct 17, 2007

Hi,

I am trying to design some functionality that emulates the recurrence functionality of MS Outlook calendar. In the calendar, users can choose a recurrence pattern (i.e. daily, weekly, monthly or yearly). Depending on the radio button that is selected, different choices appear. I am unsure as to how to model this in the database.

Here's what I have so far:

A ScheduleDetails table that will store information applicable to all schedules, regardless of recurrence pattern. One of the columns in this table will store the recurrence pattern type (0 for daily, 1 for weekly, etc.). The valid values for this column will be stored in a look-up table.

Now, if daily is selected, the user can select a radio button called 'Every <#> days' OR a radio button called 'Every weekday'. My plan is to have a new ScheduleDailyRecurrences table that has a Days field. If 'Every <#> days' is selected, the value of Days will be the value entered by the user. Otherwise, if the user has selected 'Every weekday', the value will be -1. Is this a good way to do it? I feel as though I may be attaching too much meaning to the particular value.

If monthly is selected, it gets even more complicated. The user can either select 'Day <#> of every <#> month(s)' OR 'The <count> <day> of every <#> month(s)'. I'm not sure how to model this. In my ScheduleMonthlyRecurrences table, should I have a field called 'Pattern'? Depending on the value of this field, the details would be then be stored in yet another table? Or should I just have columns in ScheduleMonthlyRecurrences for each user-entered value? This would mean that some of the fields would not be applicable depending on the radio button that the user has selected.

It's a little difficult to explain, but if you go to the Recurrence button in Outlook calendar, you'll see what I mean.

Thanks for any advice.

View 5 Replies View Related

Searching Historical Data For Patterns

Feb 17, 2008



I have a database which contains time series data (historical stock prices) which I have to search for patterns on a day to day basis. But searching this historical data for patterns is very time consuming not only in writing the complex t-sql scripts but also executing them.

Table structure for one min data:
[Date] [Time] [Open] [High], [Low], [Close], [Adjusted_Close], [MA], [DI].....
Tick Data:
[Date] [Time] [Trade]
Most time consuming queries are with lots of inner joins. So for example if I have to compare first few mins data then I have to do inner join like:
With IntervalData AS
(
SELECT [Date], Sum(CASE WHEN 1430 = [Time] THEN [PriceRange] END) AS '1430',
Sum(CASE WHEN 1431 = [Time] THEN [PriceRange] END) AS '1431',
Sum(CASE WHEN 1432 = [Time] THEN [PriceRange] END) AS '1432'
FROM [INDU_1] GROUP BY [Date]
)
SELECT [Date] ,[1430], [1431], [1432], [1431] - [1430] As 'Range' from IntervalData
WHERE ([1430] > 0 AND [1431] < 0 AND [1432] < 0) OR ([1430] < 0 AND [1431] > 0 AND [1430] > 0)
------------------------------------------------------------------------
select ind1.[Time], ind1.PriceRange,ind2.[Time], ind2.PriceRange from INDU_1 ind1
INNER JOIN INDU_1 ind2 ON ind1.[Time] = ind2.[Time] - 1 AND ind1.[Date] = ind2.[Date]
where (ind1.[Time] = 2058) AND ((ind1.PriceRange > 0 AND ind2.PriceRange >0) OR (ind2.PriceRange < 0 AND ind1.PriceRange < 0))
ORDER BY ind1.[Date] DESC;
Is there anyway I can use Sql 2005 Data mining models to make this searching faster?

View 1 Replies View Related

Which Is Better? Storing Data In The Database OR Storing It In The File System

Dec 29, 2006

Hello there,I just want to ask if storing data in dbase is much better than storing it in the file system? Because for one, i am currenlty developing my thesis which uploads a blob.doc file to a web server (currently i'm using the localhost of ASP.NET) then retrieves it from the local hostAlso i want to know if im right at this, the localhost of ASP.NET is the same as the one of a natural web server on the net? Because i'm just thinking of uploading and downloading the files from a web server. Although our thesis defense didn't require us to really upload it on the net, we were advised to use a localhost on our PC's. I'll be just using my local server Is it ok to just use a web server for storing files than a database?    

View 6 Replies View Related

Validating Inputs And Finding Patterns With PatIndex

Sep 5, 2007

---Checks that input only contains numbers
if PatIndex('%[^0-9]%','11') > 0
Begin
Print 'Not all numbers'
End
Else
Begin
Print 'All numbers'
End

---Checks that input only contains letters
if PatIndex('%[^a-z]%','aaaaa') > 0
Begin
Print 'Not all letters'
End
Else
Begin
Print 'All letters'
End


--Checking for mixed input
If PatIndex('%[^0-9][0-9]%','abc') > 0
Begin
Print 'Alpha numeric data'
End
Else
Begin
Print 'Either all numbers or all letters'
End

--Checks that value must start with a letter and a number
If PatIndex('[^0-9][0-9]%','A1anamwar11') > 0
Begin
Print 'Starts with a letter and a number'
End
Else
Begin
Print 'Does not start with a letter and a number'
End

--Checks that value must End with a letter and a number
If PatIndex('%[^0-9][0-9]','A1anamwar11a1') > 0
Begin
Print 'Ends with a letter and a number'
End
Else
Begin
Print 'Does not End with a letter and a number'
End


--Checks that value must Start with a letter and Ends with a number
If PatIndex('[^0-9]%[0-9]','namwar1') > 0
Begin
Print 'Starts with a letter and ends with a number'
End
Else
Begin
Print 'Does not start with a letter and ends with a number'
End

Namwar
<Link removed by georgev>

View 13 Replies View Related

Reporting Services :: Background Patterns And Exporting To PDF

May 16, 2012

I have a report with a chart that utilizes both colors and background patterns to distinguish various pieces of data.

The background patterns work great (they are very clear and provide excellent contrast) when viewed in the report viewer or printed straight from the report viewer.

However, when I export to PDF, the background patterns become compressed and small, almost to the point of being too small to distinguish that there is a pattern at all. The result ends up being what appears to be just a different shade of the background color. This is particularly a problem when you then print the PDF on paper, since hatching patterns are similar to how printers create different shades in the first place.

I am somewhat suspicious that this might have to do with resolution settings for PDF exports. If I could lower the resolution, perhaps the patterns would not become so tight and compressed. Below are examples of what I'm describing:

Screenshot of the report viewer:

Screenshot of the PDF:

View 2 Replies View Related

Grouping By Custom Datepart For Shift Patterns

Apr 27, 2006

My application has a log table with a timestamp field which represents the time when the record was inserted.

We would like query the the table and group the results into date units based on the value of the timestamp.

The grouping specification is held in another table but only specified for a single week.

For example

WeekDay Start End

1 06:00:00 14:00:00

2 08:10:00 17:00:00

What this specification means is that when the log table is queried records with a timestamp that fall on a Monday between 06:00:00 and 14:00:00 should be grouped together, on Tuesday the group is records between 08:10:00 and 17:00:00 and so on...

The only way I can think of doing this is to generate a temporary table when the log table is queried that has a unique record for each time period for the span of the query and then attempt to join this table to the log table using the timestamp and then group based on the temporary table unique ID.

I'm not sure how to generate such a temporary table from the specification table so any help would be appreciated.



Thanks in advance.

View 5 Replies View Related

Thoughts/patterns For The Following Use Case Related To Service Broker Dialog Network Connection

Dec 29, 2006

Hi,

I would appreciate any thoughts/ideas on the following use case for the distributed service broker application we plan to migrate from our existing proprietary tcp based message protocol using database tables for reliability.

There are two ssb services running in separate sql server instances, each on a different server machine. For simplicity, let us assume the ssb endpoint names are SSBA, SSBB. SSBB is the Initiator of the Dialog while SSBA is the Target. Now the requirement is that if the underlying network communication between the two ssb endpoints(SSBA and SSBB) is broken or if the critical service SSBB is down, then processing of any incoming message into SSBA's queue from a third service broker service (say SSBEXPR) running within a SqlExpress instance should be delayed until SSBB is alive and network communication between SSBA and SSBB is established. In our existing implementation (wherein SSBA, SSBB and SSBEXPR are windows services) we use a combination of TCP socket disconnects and Heartbeat messages between SSBA and SSBB to determine the health of network connection and that of the SSBB service.

Now my understanding of how the underlying network connection for a ssb dialog works is that if there is no activity on a dialog for a certain amount of time then the underlying network connection is closed. Is there a way to specify the amount of time to say infinite value or something and thus change this behavior? My other question is how can one query the underlying network connection (i.e. a row from sys.dm_broker_connections) associated with a particular conversation? If none of this is possible, then any other patterns/ideas/approach is welcome.

Thanks,









View 8 Replies View Related

SQLCLR-Patterns&&amp;Practices/Object Builder Error: Operation That Was Forbidden By The CLR Host

Feb 6, 2007

Hi,

Using the Microsoft Patterns and Practices "Object Builder" (Dependency Injection/Builder library), I wrote an SQL CLR Stored Procedure (using VS 2005 Professional).

All compiles and deploys ok (to SQL Server 2005 Express).

However, at run-time, I get the following error upon a "BuilderContext" object's instantiation: {"Attempted to perform an operation that was forbidden by the CLR host."}

Thoughts on how to get ObjectBuilder working in the SQLCLR?

Thanks!

Andy



(posted below is the sample code...with the run-time exception occuring on the ...BuilderContext cxt = new ... call)




Microsoft.Practices.ObjectBuilder.BuilderStrategyChain chain =
new Microsoft.Practices.ObjectBuilder.BuilderStrategyChain();

chain.Add(new Microsoft.Practices.ObjectBuilder.CreationStrategy());

Microsoft.Practices.ObjectBuilder.Locator locator1 =
new Microsoft.Practices.ObjectBuilder.Locator(null);

// Get error when new'ing BuilderContext: "Attempted to perform an operation that was forbidden by the CLR host."
Microsoft.Practices.ObjectBuilder.BuilderContext cxt =
new Microsoft.Practices.ObjectBuilder.BuilderContext(chain, locator1, null);

View 1 Replies View Related

Using A Regular Expression In MSSQL 2005 To Find Patterns Buried In A Field Full Of Misc Data

Feb 29, 2008

Thanks in advanace for taking the time to read this post.
I am using MSSQL 2005 and have created a function that allows me to use regular expressions in my SQL queries.
My question is I have a pattern buried in a field of misc data that I need to pull out just that pattern and discard the rest of the data.  Here is the Regular Expression I am using
select field1 from table1
where dbo.RegExMatch (field1,'[a-zA-Z]{4}[0-9]{6}[a-zA-Z]{2,4}')=1
This returns all values in the field that match the expression.  What I want to do now is remove all data from the field on the left and right of the expression that does not match the expression.  How would I accomplish this without reading through the 200k+ records and writing rules for every exception I run across?
so I could have Gar  b/a ge 'THE GOOD DATA' m/or1   ba4d da....ta.  All I want to do is return 'THE GOOD DATA'

View 4 Replies View Related

Design Patterns Research - Dynamic Error Count Manipulation To Determine On What Type Of Error To Stop Job

Jan 31, 2008



I would like to fail a package depending on the error. The package extracts data from Excel files. I would like to continue processing if an Excel file is badly formatted, but stop processing if there is a serious issue. like the file server hosting the Excel files crashed.
I was thinking about dynamically changing the MaxeErrorCount property based on the Error ID or description.


Any ideas on an intelligent/simple way to do this

View 1 Replies View Related

Storing SID&#39;s In SQL 7.0

Dec 16, 1999

I need to store a user ID of whoever made the last change to a record in a table. I have added a field with a default set to 'suser_sid()'.

Is it wise to store SID's in a database table if you are using NT authentication? My concerns are that if the user is deleted by the NT system administrator then I lose data integrety also if the database is backed up and restored onto a different machine with different users it won't work at all.

I'd be grateful for any help with this.


Rich

View 1 Replies View Related

Storing Images

Jan 24, 2007

Hi, can someone help me with this problem. I have recently downloaded VWD and have been playing around with it a bit. I was windering how do I add an image file to a SQL database. I have used SQL in the past but I have never store an image in it. I can add text data and so forth, but I need some pointers into adding images to the sql database. I want to be able to store the images and then retrieve them to a GridView. I have the images in an image folder within the website, but I do not know how to input the reference or link to the images in an sql table.
A quick example, say I have a table called Images, with the following info:imgID (int)imgDesc (varchar(max)imgFile (img)imgTitle (varchar(20))
To input this in sql I would write Insert Into Images (imgDesc,imgFile,imgTitle) Values ("Large fishy", "", "The Big Fish") what would I need to put for imgFile?
I would really appreciate if someone can point me in the right direction.

View 1 Replies View Related

Storing Date ONLY

Jul 17, 2007

Hi all! I am back with a new problem.
 I am designing a database in which the booking is on an hourly basis instead of daily basis. So I want my colums in a table to be like this:
================================ID(PK)Date(In this table I want date only)TimeSlot(in this table I want time only)CourtNo(facility which is to be booked)Booking ID(FK to booking table)================================
 
The thing is that SQL server donot have a date only format. I am totally stuck on this one, please help! The database which I created will be ideal if I can just store the date!
 Regards,
Taimoor

View 7 Replies View Related

Storing Images In Sql

Dec 16, 2007

Hi whats the best way to store an image in SQL, for instance the image of a product, bearing in mind the website will be hosted by a hosting company.

View 4 Replies View Related

Storing Paragraph

Mar 19, 2008

 Hi All,Does anybody know how i can store a paragraph with spaces, newline, empty lines in a sql server 2005 database table? What data type should i declare the table entry to take? I will also like to retrieve the data with what ever i would have stored it with.

View 6 Replies View Related

SQL Server Storing As �

Oct 20, 2004

My forms are taking user input, then HtmlEncoding them prior to being stored in the SQL DB. For some reason, SQL is storing quotes as � and it is causing the HTML when decoded in the page to not be rendered properly.

Has anyone come across this issue before?

For example (without encoding for readability):

SQL should store the parsed string as: <a href="someurl" class="main">

but for some reason it's being stored as: <a href=�someurl� class=�main�>.

Thoughts?

View 2 Replies View Related

Storing Images In DB

Jan 16, 2001

Does anyone have thoughts or know of resources that explain the pro's and con's of storing images in a database versus keeping the image in the file system and just storing the path to the image in the database?

View 1 Replies View Related

Storing Images

Jun 7, 1999

Hello All!
Can some one give SQL Statement on storing images from disk to the database columns.
Once I store the image how do I test it out that the image is stored correctly?
For example this is what I did
I have a table called table1., field called name

insert into table1(name) values(C:123.bmp)

Is the above statement correct? will it store the file or not?

if it does store them then how do I view them?

Can some one please help me...
Thanks in advance for your help
Venkat

View 1 Replies View Related

Storing Data

Jun 20, 2006

Hi again.

How do I store in SQL SERVER with 2 decimal places?

I set Data Type to Decimal with Scale set to 4 and Precision 19. But this doesn't work.

Any ideas? Thanks.

View 1 Replies View Related

Storing Miliseconds

Mar 28, 2005

Which datatype supports miliseconds?

View 2 Replies View Related

Help Me Out For Storing More Data

Jul 16, 2006

CREATE TABLE [dbo].[blogs] (
[blog_title] [nvarchar] (500) ,
[blog_desc_full] [varchar] (8000) ,
[blogger_name] [nvarchar] (100) ,
[mailid] [nvarchar] (100) ,
[blogid] [numeric](10, 0) IDENTITY (1, 1) NOT NULL ,
[blog_desc] [nvarchar] (125) ,
[cat_name] [varchar] (100) ,
[b_url] [varchar] (250) ,
[b_date] [datetime] NULL ,
[author] [nvarchar] (250) ,
[approval] [char] (1)
) ON [PRIMARY]
GO

using this script i have created my blog table.

and a procedure given below. i am using to insert data in it.


CREATE PROCEDURE SP_BlogAdd

@blog_title nvarchar(500),
@blog_desc_full varchar(8000),
@blogger_name nvarchar(100),
@mailid nvarchar(100),
@blog_desc nvarchar(125),
@cat_name varchar(100),
@b_url varchar(250),
@author nvarchar(250)

AS

INSERT INTO blogs(blog_title, blog_desc_full, blogger_name, mailid, blog_desc, cat_name, b_url,author)
VALUES(@blog_title ,@blog_desc_full ,@blogger_name,@mailid ,@blog_desc ,@cat_name ,@b_url,@author)
GO

now, the problem i m facing is.
i am using varchar datatype for [blog_desc_full] [varchar] (8000).

i want more than this size to store data in it.

please give me some detailed code.

i tried text datatype but i didnt succeed. how to use text datatype.
i replaced with text datatype.but in length i couldnt type. it shows only 16.

Please help me out.

regards,
ASIF

View 1 Replies View Related

Storing XML In Database

Jul 20, 2012

best way to store questionnaire data in a database.Since different questionnairs have different questions and formats i.e dropdown, radio, checkboxes etc building such a database model becomes highly complex.

I've read that if data schema is complex and higly variable it may be better to use an xml document and store that in a databse. However I dont quite understand how you store xml to a database. Do you simply store the entire structure in something like a nvarchar column or is there some other way to store xml to a database.

If you store the entire structure to the databse then how do you query the content to generate reports.

example xml:

Code:
<survey>
<meta>
<id>sample</id>
</meta>
<questions>
<question id="1" type="singlechoice" page="1">

[code]...

View 3 Replies View Related

Storing Hours

Mar 17, 2004

I use SQL 2K with an Access 2000 project as front end. I have four date fields in a table. The first one should contain a date (eg 20th of February), the second one a starting hour (eg 8:00h), the third one the finishing hour (eg 10:00h) and the fourth should calculate the difference between the second and third column.
So I created four datetime fields. Storing a date in the first column is no problem, but storing only hours doesn't seem to do what I want. When I enter 8:00 from within the Access, it is stored 1/1/1900 8:00 in SQL Server. How can I make sure that the hours are saved with the date of the second column, so either as 8:00 without further information or as eg 20-2-2004 8:00?

View 14 Replies View Related

Storing Newlines

Apr 6, 2004

Hello Friends,
How to store newline charecters in sqlserver db. Iam implementing a varchar type attribute.

Regards,
Ch.Praveen

View 1 Replies View Related

Storing Time

May 21, 2004

how can i store time in my table

1 hr:55 mins:22 secs

View 4 Replies View Related

Storing Records

Feb 25, 2006

I have a table name "ABCD" When I run a Select statement on this table, it returns 100 rows. I would like to store this 100 records for future.

In future I will have the same table with same sturcture. I want to insert this 100 rows into this table.

Any suggestions.

Thanks in Advance

View 5 Replies View Related

Storing Date

Jun 14, 2006

i need to store date alone in a new field from the existing field which is stored date along with time.

Eg:
old field: emplogintime (date and time)
new field: emploginday (date)

View 4 Replies View Related

Storing A Value, Vs Computing A Value

Sep 5, 2007

Hi,

I'm having a DB designed for me, and I'm inspecting it and wondering what in general is the better way to do this.

We have a product, which we are counting "product views". The DB designer has created columns called "view_today" and "views_alltime".

I specified I wanted a normalized database, I'm thinking this is technically not normalized ? Am I correct ?

Wouldn't it be better to have a query that counted the views off the logging table ? I can't see any advantage to doing it the way its been designed except to save time.

Thanks for any input !

Mike123

View 3 Replies View Related

Storing A Month

Jul 23, 2005

Hello all,I have been working with several databases here that are basically datamarts. A lot of the entities have an attribute that is a particularyear and month. For example, a financial transaction may be posted fora particular month, regardless of the actual date on which it occurred.In this system, these year/month combinations have typically beenstored as integers of the form YYYYMM. My question is, how have othersstored this type of information and what advantages/disadvantages haveyou found to your method?The problem that I have found with the current method is that youcannot easily find the difference between two of these dates. Forexample, 200401 - 200312 = 89 (not 1). Storing the values as datetimes(using the first of the month) allows for DATEDIFF(mm, '2003-12-01','2004-01-01') = 1. Of course, a little extra (and meaningless) data isbeing stored. In case the table sizes makes a difference here due tothe extra data being stored, we are usually talking about over 100Mrows.I don't like the idea of storing the values in two columns (year andmonth) because that does nothing to improve on the ability to performuseful functions on the values and very importantly, the month reallyhas no meaning without the year, so I don't think that it should bestored by itself.Thanks for any advice/insight.-Tom.

View 1 Replies View Related







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