SQL 2012 :: Converting From Table With Varbinary To Filetable

Feb 17, 2014

I have a very large database running in a production environment. The backup files are getting to be very difficult to manage. They are at 70gb as of now and growing at a rate of 10gb per month. This is due to document images being stored in the database in one table. I have read a little about a new feature in SQL Server 2012 called Filetable. Can we migrate to SQL Server 2012 and convert to the filetable structure, will this decrease the size of the backups? Would backup of the document images be taken care of by our nightly file system backups now?

View 1 Replies


ADVERTISEMENT

SQL 2012 :: Approach For Using Filetable

Feb 17, 2015

What is the best approach that I can take for the below requirement.

I am designing a tool that basically stores the information of employees. Once a person joins any organization, they need to enter their personal details through this tool.

The basic information that a person is required to enter includes

Firstname, Lastname,DOB, Phonenumber, permanentaddress,tempaddress,etc.,

Along with these details, the user also needs to upload their photo and their educational details and upload all relevant certificates.

I have designed a table for employee personal details as 'Employeedetails' that includes columns

Empid
EmpFirstname,
Emplastname,
EmpPhonenumber,...

Now to store the employee photo and their educational certificates, I wanted to know , what would be the right approach.

I have googled on this and came across the concept of Filetable in sqlsever 2012. But it behaves independent of other tables. How would I store employee details and have a reference to filetable that can store images and other docs in a physical location. Or is it a good way of storing images and docs in DB directly.

View 0 Replies View Related

SQL Server 2012 :: Full-Text Search On FileTable

Apr 11, 2014

I am new to Full-Text Searches and FileTables. I am working on a resume search system. I created a FileTable and the Share which contains about 51,000 resumes in Word (DOC/DOCX), PDF and TXT formats that were copied over from our main file server. I followed the instructions on adding the Microsoft Filter Pack 2.0, and all searchable file types are listed in sys.fulltext.document_types.

I have a program that searches resumes by First and Last Name and/or E-mail Address. For a while, we thought it was working fine because we were getting hits, but then we noticed some Names and E-mail Addresses we new existed were not showing up in my CONTAINS queries -- but we verified the documents do exist and the Names exist in the File Name and inside the document along with the E-Mail address.

One example I'm working on now cannot find the First/Last Name with CONTAINS(name,"lastname") in a Word DOC file, but I can find the document using LEFT(name,5) = 'Smith'. It's a Word DOC file. For testing purposes, I opened the DOC file in Word, then used Save As to create a TXT and DOCX file within the same folder. Now, both of those are showing up in the CONTAINS but not the original DOC file.

View 0 Replies View Related

Converting Varbinary To Varchar

Jun 23, 2005

I have a password field which is of varbinary. Since its a varbinary I
cannot see the password in the database I only see hexadecimal values.
Now my question is that how can I convert those hexadecimal values to
string or varchar so I can read the password. 

any ideas ??

View 1 Replies View Related

Issues Converting A Varbinary(50) To String.

Mar 31, 2008

Hi Gurus,
Here is my problem-:
I have a field in the SQL 2005 database with type varbinary(50). Now when i enter value to this field, I enter a value for example 111111101. The reason to enter such a value in varbinary(50) type is, that this value is meant to grow, as each 1 and 0 in this value is a permission or right my user would have to various features of the web application, I am designing. Now when I open the table to see the data in the database, it shows as <Binary data>. But that's okay, as binary fields are mostly meant to store pictures, files etc. But when I read this value into my ASP.Net code using c#, the value as returned as 069F6BBD. After some research I realized that for decimal value 111111101, the hex value is 069F6BBD.
All I need in my code is the same thing that I entered which is  111111101.
Can someone guide me a lil bit.
Thanks in advance..
VJ 
 
 
 
 

View 7 Replies View Related

Converting A Hex String To A Varbinary Or Vice Versa

May 5, 2006

I'm using SQL Server 2005. How can I convert a hex string to a varbinary or the opposite of that?

View 6 Replies View Related

Integration Services :: Error Converting Nvarchar (512) To Varbinary (max)

Aug 27, 2015

I am using rowVersion to detect rows that need to be re-extracted for my ETL.  The first step in the ETL is to get MIN_ACTIVE_ROWVERSION() from the database, as well as the rowVersion from the last successful ETL run.  Both of these values are saved in variables in SSIS.  Since SSIS doesn't have an associated data type, these values are converted to nvarchar(512) before getting sent to SSIS.  

I'm now trying to create a stored procedure to grab the data out of the source system.  The sproc takes RowVersionMin and RowVersionMax as input parameters.  Those parameters are then converted to varbinary(max), and I use them in a query to select the appropriate rows.

When I run the sproc in SSMS, it runs without a problem.  However, when I try to use the sproc as a data source in SSIS, I get the following error: "Error converting data type nvarchar to varbinary". Why SSIS has a problem with this, but SSMS does not?  The sproc code looks like this:

ALTER PROCEDURE [dbo].[dw_DimComment_DataLoad]
@RunType varchar(3),
@RowVersionMin nvarchar(512),
@RowVersionMax nvarchar(512)
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from

[Code] ....

View 2 Replies View Related

Trouble Converting A Varbinary (Object) To A String Through Script Task

Dec 9, 2006

I have an Execute SQL Task that queries for the contents of a file (which is declared as a varbinary type). My SSIS package needs to write these contents into a temporary location, so what I do is that I pass the result into a System.Object variable. I then use that variable in a Script Task.

Problem is whenever I execute my script task and DirectCast or CType the variable to a string (which is what the contents of the file is), I get a "Conversion from type '_ComObject' to type 'String' is not valid."

Any ideas on how to go about this problem?

View 1 Replies View Related

SQL 2012 :: Converting Case Statement To Config Table?

Nov 3, 2015

I have a stored procedure in which we are deriving some flags. So, we used series of CASE statements.

For examples

CASE
WHEN LEFT(CommissionerCode, 3) IN ('ABC','DEF',...) THEN 1
WHEN PracticeCode IN (.......) THEN 1
WHEN (CommissionerCode IN (.....) OR PracticeCode NOT IN (.....) OR .....) THEN 1
ELSE 0
END

I need to put these conditions in config table and generate dynamic sql.

What is the best way to do this? especially, 3rd condition with OR logic with multiple columns involved.

View 2 Replies View Related

SQL Server 2012 :: Moving Identical Data From One Table To Another - Error On Converting To Float

Jun 11, 2014

So I have two tables with similar columns etc, unfortunately the Insert to the History table fails. Noto sure how to format.

Source Table.
CREATE TABLE [dbo].[SKUCURRENT](
[UID] [int] IDENTITY(1,1) NOT NULL,
[SKU] [nvarchar](100) NOT NULL,
[WHSELOC] [nvarchar](50) NOT NULL,
[WEIGHT] [nvarchar](50) NOT NULL,

[Code] ....

View 1 Replies View Related

SQL 2012 :: Parsing Large Varbinary Fields

Jun 9, 2015

I have a table with raw scientific test results in a single field, some of which are over 25Mb field. I need to parse into the field to find and aggregate selected values from the field.

Table structure is
CREATE TABLE [dbo].[Gxxx_Data](
[id] [uniqueidentifier] NOT NULL,
[Status] [nvarchar](50) NULL,
[GxxxItem_ID] [int] NULL,
[Stats_Data] [varbinary](max) NULL,
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

[code]...

From which I need to parse and summarize the (Assembler) opcodes (MOV,CMPi, SHR etc...)I need to parse the large field [Stats_Data] to locate the target data.The internal result strings are delimited with Char(10), conservative counts are from 64k to over 100k lines in each record. Is there a way to parse the individual lines into another table (temp) that would be queried/regexed ?

View 9 Replies View Related

SQL 2012 :: Converting Time String In Temp Table To Military Time Then Cast As Integer?

Dec 26, 2014

I need to take a temporary table that has various times stored in a text field (4:30 pm, 11:00 am, 5:30 pm, etc.), convert it to miltary time then cast it as an integer with an update statement kind of like:

Update myTable set MovieTime = REPLACE(CONVERT(CHAR(5),GETDATE(),108), ':', '')

how this can be done while my temp table is in session?

View 2 Replies View Related

Add Many Images As Varbinary(max) To Table

Jun 6, 2008

Hello,

I am trying to create a statement that will update many rows in a table with images, stored as varbinary(max), into a new column.

The path/file information is all stored in another table, but I can't find a way to update more than 1 at a time. Here is the statement that works for 1 row at a time:

update tblphotos set photo = (select
BulkColumn from
Openrowset( Bulk '\**servername**PropsImagesDon Giovanni 2002PropsHorses Guts 2.jpg', Single_Blob) as photo
)
where photoseq = 27


but if I try to do something like this:


CREATE TABLE #temp (

photoSeq int,

photoLoc varchar(255),

photo varbinary(max)

)

INSERT #temp

select p.photoseq, f.fldlocation + p.photophyloc as files,
(select
BulkColumn from
Openrowset( Bulk f.fldlocation + p.photophyloc, Single_Blob) as photo
)
FROM txprops t
join tblfolders f on t.fldlocation = f.fldseq
join tblphotos p on p.photopropseq = t.propseq

begin tran

update a set photo = b.photo
from tblphotos a
join #temp b on a.photoseq = b.photoseq
where a.photoseq = b.photoseq

select * from tblphotos order by photophyloc

commit tran
drop table #temp


I get an error: Incorrect syntax near 'f'.
I think this is because I can only put a path in beside BULK.

I have investigated BULK and bcp commands, but cannot find anything to satisfy this. I tried the DTS package route, but am not getting very far.

Any suggestions? Is DTS the solution for me?

View 2 Replies View Related

Programmatically Remove Varbinary Data From Table

Mar 29, 2008

Hey all,
I have a profile table for members of a website that allows them to upload an avatar for use throughout the site. I decided to add the option to just remove the avatar if they want to no longer use one at all and I am stuck.
I am running an update statement against thier entire profile incase they change more then just removing thier avatar but of course when I try this statement.
myCommand.Parameters.AddWithValue("@avatar", "")
I get a conversion error, which makes sence. So what instead of "" do I need for code to just insert empty data to overwirte thier current avatar data.
Any help would be great, thanks for you time.

View 5 Replies View Related

Programmatically Move Varbinary Data From One Table To Another

Apr 6, 2008

Hey all,
Another varbinary question.
I am trying to move an image stored in a table varbinary(max) directly from one table to another programmatically.
The rest of the data is just nvarchar(50) so I just use a T-SQL select statement in the code behind and feed all of the date into an SqlDataReader, I do this becuse there is some user interaction when the data is moved, so there may be some new values updated when transfering from one table to another, so once the old and possibly new data is stored in seperate variables then I use a T-SQL insert statement to move all of the data into the other table.
Problem is I am not really sure how to handle the image data(varbinary(max)) to just do a straight up transfer from the one table to another. I get conversion errors when trying to handle the data as a string which makes sense.
Not sure what to put for code examples since I really am stumped with this, but here is what is not working.
Dim imageX As String
SqlDataReader Code - imageX = reader("imageData")
Insert code - myCommand.Parameters.AddWithValue("@imageData", imageX)
Thanks in advance,

View 6 Replies View Related

DB Design :: Can Use Another Server / Disk To Store Files Using FileTable Concept?

May 11, 2015

I tried samples of FileTable in SQL Server 2012 to store files in database. I have following questions.

1. When I right click on FileTable, and say Explore File Table Directory, I was taken to a directory. But if I search the same directory in my server/machine, the directory is not available.

2. Can I use some external server/disk as a directory for FileTable?

3. How easy is to use FileTables using .Net web applications?

View 2 Replies View Related

SQL 2012 :: Second Delimiter And Converting

Nov 26, 2014

I have a PL/pgSQL Code like this:

[code=" CREATE OR REPLACE FUNCTION public.split_string(text, text)
RETURNS SETOF text
LANGUAGE plpgsql
AS $function$
DECLARE
pos int;

[Code] ....

Its split a String with a delimiter. Like this

[code="select * from split_string('3.584731 60.739211,3.590472 60.738030,3.592740 60.736220', ' ');

"3.584731"
"60.739211,3.590472"
"60.738030,3.592740"
"60.736220""][/code]

My question is how i can save the first result in a temp_array (or table i dont know) so I can get the result and split up the results again with the delimiter ','.

View 1 Replies View Related

SQL 2012 :: Converting XML Files To PDF And Zip In Folder

Jun 16, 2015

Convert 100 xml files individually to pdf's and zip them in a folder along with the source files.

Can it be possible in SQL server BI world?

If possible make this an automated process for every 100 files.

View 3 Replies View Related

SQL 2012 :: Converting Fahrenheit To Celsius

Jun 16, 2015

I'm knew to Sql, I've tried many variations, and I keep getting errors:

CAST(ROUND(IP_BLa.MEAS_VALUE-32)*5/9,2)
CAST(ROUND(IP_BLa.MEAS_VALUE-32)*5/9,2)as decimal(3,2))

View 1 Replies View Related

SQL 2012 :: Converting Query To XML Result?

Jul 15, 2015

I'm struggling to modify the T-SQL query below to return the results as XML.

SELECT ProductModelID, Name
FROM Production.ProductModel
WHERE ProductModelID IN (119, 122);

The XML result document should have the following structure:

<Root>
<ProductModelData id="119">
<Name>Bike Wash</Name>
</ProductModelData>
<ProductModelData id="122">
<Name>All-Purpose Bike Stand</Name>
</ProductModelData>
</Root>

View 2 Replies View Related

SQL 2012 :: Converting Access Queries To Views

May 13, 2014

Is there an easy way to convert Access Queries to SQL Views without doing it manually?I have used the Databse tool to migrate tables, but cannot see to find something similiar for queries.

View 3 Replies View Related

SQL Server 2012 :: Converting XPath To FLWOR

Jun 9, 2014

I'm trying to go deeper into SQL Server's XML support. When looking at a recent forum post, I got curious to see if I could achieve the same result with XPath and FLOWR. Here's the data I'm working with:

create table #data (myXMLData xml)
insert into #data(myXMLData) values (
'<?xml version="1.0" encoding="utf-8"?>
<order>
<Product Index="e1e2c499-f9...etc...." ProductID="12" >
<Attribute Name="Paper...etc..." />

[Code] ....

Here's the working XPath query and results:

select data.mynodes.value('@Name', 'varchar(50)') Name
from #data
cross apply myXMLData.nodes('/order/Product/Drops/Drop[@Number="1"]/Area') data(mynodes)
Results:
Name
43001PBOX

[Code] .....

Here's my first attempt at a FLWOR expression. Note that doesn't produce the same results.

select myXmlData.query('
for $drop in /order/Product/Drops/Drop
for $Name in $drop/Area/@Name
where $drop/@Number=1
return data($Name)
')
from #data
Results:
43001PBOX 43001R001 43001R002 43023PBOX 43023R001 43023R002 43031PBOX 43031R001

How to build a FLOWR-based query that produces the same result as the pure XPath one?

View 1 Replies View Related

SQL Server 2012 :: Converting Varchar To Datetime?

Mar 19, 2015

I am using a custom sql query to import data into Tableau. Problem is I need to change the varchar column data in SQL currently returning 18/01/2014 08:35:13 as a format into the date format 05/21/2014 3:55:51 PM before I can use it.

View 9 Replies View Related

SQL Server 2012 :: Converting Nvarchar To Datetime

Jul 24, 2015

I have a column name DateofRecord and it is nvarchar type..all the values in this column are like this

"04/24/2013'
"05/01/2014"...etc...

My requirement is to convert this column into Datetime ?

I tried so many ways using cast and convert functions like cast(dateofrecord,datetime) or like convert(datetime,replace(DateofRecord,'"','''')) ..it didnt worked..

View 9 Replies View Related

SQL Server 2012 :: Differences In Rounding / Converting Strings?

Dec 9, 2013

difference between

SELECT ROUND ('6.465',2) --- result 6.46
and
SELECT ROUND (6.465,2) --- result 6.47
with

It's because you're relying on an implicit conversion from a string to a decimal data type which SQL server will do to 2 decimal places by default...

Alright:

SELECT ROUND (CONVERT(DECIMAL(3,2),'6.465'),2) --- result 6.47 Now please explain this:
SELECT ROUND('0.285',2) -- 0.28
SELECT ROUND(0.285,2) -- 0.29
SELECT ROUND (CONVERT(DECIMAL(3,2),'0.285'),2) --- result 0.29 The string value does not seem to be converted to decimal with 2 decimal places.

MS is on the safe side with mentioning the last digit is always an estimate But because the result of the estimate is always the same, I would like to know:

* how is a string value exactly implicitly converted?

* how exactly does the estimation work, that in case of doubt rounds a value up or off?

View 2 Replies View Related

SQL Server 2012 :: Conversion Failed When Converting Varchar Value

Dec 19, 2013

Within in Visual Studio 2012 solution, I have several projects, one of which is a Database project. I am defining several tables. The one in question is:

CREATE TABLE [dbo].[tblKppHierarchyPcl]
(
[ID] NUMERIC(18,0) NOT NULL,
[Name] VARCHAR(500),
[PartStructureKey] NUMERIC(18,0) NOT NULL,
[PartNumber] VARCHAR(500) NOT NULL,
[ParentPartNumber] VARCHAR(500) NULL,

[code]...

Error SQL72014: .Net SqlClient Data Provider: Msg 245, Level 16, State 1, Line 76 Conversion.failed when converting the varchar value 'Coolant Quick Disconnect' to data type int.So it has a problem with inserting 'Coolant Quick Disconnect' into the Name column. The Name column is CLEARLY a varchar column but somehow it thinks it's an int column.

View 8 Replies View Related

SQL Server 2012 :: Inconsistent Results When Converting To Time?

Jun 5, 2014

I have a lot of rows of hours, set up like this: 0745, 0800, 2200, 1145 and so on (varchar(5), for some reason).

These are converted into a smalldatetime like this:

CONVERT(smalldatetime, STUFF(timestarted, 3, 0, ':')) [this would give output like this - 1900-01-01 11:45:00]

This code has been in place for years...and we stick the date on later from another column.

But recently, it's started to fail for some rows, with "The conversion of a varchar data type to a smalldatetime data type resulted in an out-of-range value".

My assumption is that new data being added in is junk. If I query for these values and just list them (rather than adding a column to convert them also) that's fine, of course. I've checked all the stuffed (but not yet converted - so 11:45 rather than 1145) output to see if it ISDATE(), and it is. There are no times with hours > 23 or minutes greater than 59 either.

If I add the CONVERT in, we see the error message. But here's the oddity, if I place all of the rows into a holding table, and retry the conversion, there is no error. It's this last bit that is puzzling me. Plus I can't see any errors in the hours data that would cause a conversion problem.

I've put the whole of this into a cursor to try to trap the error rows too, but all processes fine. Why would it fail if NOT in a cursor?

View 9 Replies View Related

SQL 2012 :: Converting Directory File Path Into HierarchyID

Jul 22, 2014

I am trying to create hierarchyID for a directory file path.

View 1 Replies View Related

SQL Server 2012 :: Conversion Failed When Converting Date

Oct 30, 2014

I have been trying to convert datetime but keep getting this error(Conversion failed when converting date and/or time from character string.It works just fine if I don't use execute sp_executesql,.

<code>
DECLARE @tablename AS nvarchar(max)
DECLARE @SQLQuery AS NVARCHAR(MAX)
DECLARE @ParameterDefinition AS NVARCHAR(100)
DECLARE @startdate datetime

[code]....

View 5 Replies View Related

SQL 2012 :: Save Real Datatype Without Converting To Exponential?

Sep 21, 2015

I want to save 999999999 as real data in sql.but it saved 1+E09.

how can I save 999999999?

View 9 Replies View Related

SQL Server 2012 :: Converting Year And Month Varchar To Date

Jan 31, 2014

I have a table with Month , Year as varchar. I realized it was a big mistake. Since its getting too complicated to query this way.

Year Month Productname
2013 11 ACB
2013 11 CDE

I would now like to add another column called date and store these Year Month as a date to my existing table

Year Month ProductName Date
2013 11 ACB 2013-11-01
2013 11 CDE 2013-11-01

Is there a way I can do it for all the columns of the existing table ??

View 3 Replies View Related

SQL Server 2012 :: Converting Query Output To HTML Format

Mar 23, 2015

I am working on a code that will convert the query output into a html query output. That is the output of the query will be along with html tags so that we can save it as a html file.

The stored procedure that i have used is downloaded from symantec website and is working fine. Below is the code of that stored procedure.

/****** Object: StoredProcedure [dbo].[sp_Table2HTML] Script Date: 12/21/2011 09:04:30 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[sp_Table2HTML] (
@TABLENAME NVARCHAR(500),
@OUTPUT NVARCHAR(MAX) OUTPUT,

[Code] ....

The code works fine and i am able to get the output with html tags. The problem occurs when i insert stylesheet in the code. I tried to enforce styles using a stylesheet for the table returned in my sql code, so that it will look good. below is the stylesheet code that i inserted between <head> and </head> tags.

<style type="text/css">table.gridtable { font-family: verdana,arial,sans-serif; font-size:10px; color:#333333;border-width:1px; border-color: #666666; border-collapse: collapse; } table.gridtable td {border-width: 1px; padding: 8px; border-style: solid; border-color: #666666; background-color: #ffffff;}</style>

If I run the procedure without the style sheet code, it works fine. but when i run the procedure with style sheet code i am getting the below errors.

Msg 105, Level 15, State 1, Line 98
Unclosed quotation mark after the character string '</table></body><'.
Msg 102, Level 15, State 1, Line 98
Incorrect syntax near '</table></body><'.

[Code] .....

I checked the code and i am not able to find what is the mistake. I tried changing the quotation mark but it didn't worked.

View 6 Replies View Related

SQL Server 2012 :: Converting Large Excel Spreadsheet To Normalized Data

Aug 7, 2014

I have a large excel spreadsheet created by finance user that contains several decades worth of sales data.

Here is a small sample:

Guest Count
Unit ID1/2/2011 1/9/2011
3 0
7 0
8 0
90 0
151696 1202
222769 1914
232704 2110
250 0
282838 1882
331089 691
363581 3064
371469 1062

I need to get this data into an SQL table in the following form so I can use it to further manipulate the data and update several other tables. I am thinking that UNPIVOT or CROSS APPLY might be the way to go, but am not sure how to code it.

The desired output:

Unit IDDate Guest Count
31/2/2011 NULL
71/2/2011 NULL
81/2/2011 NULL
91/2/2011 0
151/2/2011 1696

and so on ......

The spreadsheet has 2900 columns and 3500 rows so performance is definitely a consideration as well.

View 9 Replies View Related







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