Select Word Size
May 14, 2008Is it possible to select words that have a certain char size in a given field?
View 1 RepliesIs it possible to select words that have a certain char size in a given field?
View 1 RepliesI have a strange SQL statement
Select * from TableName WH
Basicly I have a code that creates a Dynamic SQL statement
in this case I thought that I will get an error on the above statement but infact I did not
I tested it on the Enterprise Manager
and it works fine
I changed the WH to WHER it works as long as its not a reserved word
so if I put my name or what ever after that sql it still works
unless I use two words with a space between them it will give an error
on the second one not the first
Can anyone tell me why is that
I do not know if its a feature or what
Thank you in advance.
In company there are two version of app. New one save order status as "Ordered" the old save as "ORDERED". In order to find out who use old version, how to code in where clause like below?
select userid from order where status = 'ORDERED' (only capital)
(Above code will list all)
I have an application providing me with multiple headers which I havemergerd into one big header (below), this header my not always be thesame but I need to be able to extract a periodstart and periodend fromit. The periodstart will always be the third substring from the end(or 3rd from right) and the periodend will always be the firstsubstring from the end (or 1st from the right).How can I extract the periodstart and periodend?E.g:- Header'Jensen Alpha TR UKN GBP BM: Caut Mgd BM (50% FTAllSh 50% ML £ BroadMkt) RF DEF:RFI 3Y 31/08/2004 To 31/08/2007'I currently have the sql: convert(Datetime,(dbo.FDHGetWord(@FullHeader, 20)) ,103) but this only works in thisinstance, I need to use someting like the RIGHT function or REVERSEfunction but I can't get the sql right.Can someone please help!????
View 1 Replies View Relatedi have report with parameter and he can have a null in parameter ther is null word can i change it to another word like all or any thing else
View 4 Replies View Relatedhi!
I'm just wondering does anyone know how to create an sql command that can search word by word?
what i mean is like I have a product with name 'harry potter broom'.
I want an sql command where if i type only 'harry broom' this 'harry potter broom' product will show up.
Does anyone have any idea?
Here's my sql comand: (I'm using asp.net vb script do develop this system)
-------------------------------------------------------------------------
query = "select distinct * from product where " & _
"(pname like '%" & keyword & "%' or " & _
"pdesc like '%" & keyword & "%' ) and " & _
"(price >= " & price1 & " and price <= " & price2 & _
") and status <> 'out of stock' order by price asc"
-------------------------------------------------------------------------
Thank you.
I am trying to resize a database initial log file from 500M to 2M. I€™m using€?
ALTER DATABASE <DBNAME> MODIFY FILE ( NAME = <DBLOGFILENAME, SIZE = 2 ) "
And I'm getting "MODIFY FILE failed. Specified size is less than current size." I tried going into the database properties and setting the log file to 2M, but it doesn€™t keep the changes.
Any help with this process?
Hi
I'm trying to figure out how to retrieve the size of the data used per record, not the allocated size per row.
Any pointers would be helpfull.
Thanks in advance!
Rgds,
Worf
When a SQL statement is executed against a SQL Server database is therea server-side setting which dictates the size of the fetch buffer? Weare having some blocking issues on a new server install which do notoccur on the old server until a much larger volume of data is selected.Any help appreciated.
View 2 Replies View Related
Is the word "Name" a reserved word in SQL? look at line 10 of my stored procedure. When I use the word "Name"it is highlited in blue by SQL Server?
Note I only list part of the stored proc
1 CREATE PROCEDURE [dbo].[GetXMLPeopleNames] 23 (4 @Status nvarchar(3)5)6 AS7 SELECT8 PersonId,9 PersonDescription,10 Name,11 UpdateDate,12 UpdateAppUser13 FROM14 Customer WHERE Customer.PersonDescription=@Status15 ORDER BY
Hi all,
I work for a financial company where we send out lots of correspondence to clients on a daily and monthly basis. This would typically be something like a financial report, account statements, etc. We've decided to use PDF as the format which these documents must be in when our clients receive them.
Our marketing and sales departments designs the templates of these documents using Microsoft Word. They can save these MS Word documents in the Word XML format (either 2003 or 2007). We want it in XML format, because it is text based, and we can therefore string replace the content to update the template with a client€™s information. In the same token RTF would also do, but the file size when converted to RTF is a problem.
What I am looking for is a way to convert this XML into PDF using something like XSL-FO - i.e. we do not want to use the Word Interopt on our Production Server, firstly it is a little slow and secondly the production server is unmanned and we cannot allow a WinWord.EXE process to not close successfully for some or other reason.
I've tried a number of companies' evaluation software to try and achieve this (converting the WordML to PDF via XSL-FO), but so far no luck.
Does anybody know of a stylesheet out there with which I will be able to achieve this? Or an alternative method of converting MS Word files into PDF without using Word to do it?
Thank you in advance.
Regards
I installed sql 2005 a while back. Then I recently found out my file system was fat32 (I don't understand why the hardware people did this...) and I had to convert to NTFS. Naturally the sql service no longer worked so I uninstalled inorder to reinstall now I can't reinstall it I keep getting this message
native_error=5039, msg=[Microsoft][SQL Native Client][SQL Server]MODIFY FILE failed. Specified size is less than current size.
I'll try to post the full log in a new post.
Hi folks,Can anyone enlighten me here? I'm trying to use a SPROC which, when supplied with an int, looks up the table and returns certain columns from it. I'm using a SqlCommand, here's my codebehind: ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ SqlCommand dataSource = new SqlCommand("retrieveData", new SqlConnection(dbConnString)); dataSource .CommandType = CommandType.StoredProcedure; dataSource .Parameters.AddWithValue("id", poid); dataSource .Parameters.AddWithValue("title", title).Direction = ParameterDirection.Output; dataSource .Parameters.AddWithValue("creator", creator).Direction = ParameterDirection.Output; dataSource .Parameters.AddWithValue("assignee", assignee).Direction = ParameterDirection.Output; etc, etc... And the SPROC:------------------------------------------------------------------------------------------------------------------set ANSI_NULLS ONset QUOTED_IDENTIFIER ONGOALTER PROCEDURE [dbo].[retrieveData] @id int, @title varchar(50) OUTPUT, @creator varchar(50) OUTPUT, @assignee varchar(50) OUTPUT, @contact varchar(50) OUTPUT, @deliveryCost numeric(18,2) OUTPUT, @totalCost numeric(18,2) OUTPUT, @status tinyint OUTPUT, @project smallint OUTPUT, @supplier smallint OUTPUT, @creationDateTime datetime OUTPUT, @amendedDateTime datetime OUTPUT, @locked bit OUTPUT AS /**SET NOCOUNT ON; **/ SELECT [title] AS [@title], [datetime] AS [@creationDateTime], [creator] AS [@creator], [assignee] as [@assignee], [supplier] as [@supplier], [contact] AS [@contact], [delivery_cost] AS [@deliveryCost], [total_cost] AS [@totalCost], [amended_timestamp] AS [@amendedDateTime], [locked] AS [@locked] FROM purchase_orders WHERE [id] = @id; ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ The id being passed in is definately not null, and is set to a value of an item I know exists. The resulting error is:
Exception Details: System.InvalidOperationException: String[1]: the Size property has an invalid size of 0.Line 63: retrievePODetails.Connection.Open();Line 64: retrievePODetails.ExecuteNonQuery();[InvalidOperationException: String[1]: the Size property has an invalid size of 0.] System.Data.SqlClient.SqlParameter.Validate(Int32 index) +717091... ... Can anyone see anything I'm missing? Thanks,Ally
Using C#, SQL Server 2005, ASP.NET 2, in a web app, I've tried removing the size from parameters of type NCHAR, NVARCHAR, and VARCHAR. I'd rather just send a string and let the size of the parameter in the SP truncate any extra chars if need be. I began getting the error below, and eventually realized it happened only with output parameters, as in the code snippet below.String[3]: the Size property has an invalid size of 0. par = new SqlParameter("@BusinessEntity", SqlDbType.NVarChar); par.Direction = ParameterDirection.Output; cmd.Parameters.Add(par); cmd.ExecuteNonQuery();What's the logic behind this? Is there any way around it other than either finding out what the size should be, or assigning a size larger than would ever be needed? ThanksMike Thomas
View 6 Replies View RelatedI have one db test with one .mdf and .ldf file...mdf file size is 100mb and for some reson i removed all the tablesfrom that .mdf file and transfer it into new secondary file so all thetables moved into secondary file now i want to reduce the first .mdffile from 100 mb to 50mb is that possible,it's showing 90mb is free.Please reply
View 1 Replies View RelatedI want to know encrypted data's size for designing database field size.
For example, cardnumber varchar(20) Encrypted by Triple_DES and PassPhrase, How match size does need to encrypted data store field.
I think the size does not depend to PassPhrase char length.
Regards,
Yoshihiro Kawabata
I am getting error to run stored procedure using executenonquery method. The Stored Procedure is having OUTPUT parameter.
ExecuteNonQuery statement is called using SqlHelper.
Error : String[18]: the Size property has an invalid size of 0
Just wanted to know what is a general rule of thumb when determining log file space against a database's data file.We allow our data file for our database to grow 10%, unlimited. We do not allow our log file to autogrow due to a specific and poorly written process (which we are in a three month process of remove) that can balloon the log file size.Should it be 10% of the Data file, i.e. if the Date file size is 800MB the log file should be 8MB?I realize there are a myraid of factors that go against file size but a general starting point would be nice.ThanksJeff--Message posted via http://www.sqlmonster.com
View 4 Replies View RelatedThe Tabular model is showing 19 GB on disk, but it is acquiring around 40 GB in memory.
View 3 Replies View RelatedHi,
An MSSQL DB running SAP indicates a smaller DB size (MMC & SAP) than the actual physical size. The difference is about 8 GB.
A lot of records were deleted before this. Did they remain in the DB as NULL values or something ?
Does anyone know what the reason for this could be ? And how to clean this up ?
Thanks in advance,
Paul
Hi,
i use this script that show me the size of each table and do the sum of all the table size.
SELECT
X.[name],
REPLACE(CONVERT(varchar, CONVERT(money, X.[rows]), 1), '.00', '') AS [rows],
REPLACE(CONVERT(varchar, CONVERT(money, X.[reserved]), 1), '.00', '') AS [reserved],
REPLACE(CONVERT(varchar, CONVERT(money, X.[data]), 1), '.00', '') AS [data],
REPLACE(CONVERT(varchar, CONVERT(money, X.[index_size]), 1), '.00', '') AS [index_size],
REPLACE(CONVERT(varchar, CONVERT(money, X.[unused]), 1), '.00', '') AS [unused]
FROM
(SELECT
CAST(object_name(id) AS varchar(50)) AS [name],
SUM(CASE WHEN indid < 2 THEN CONVERT(bigint, [rows]) END) AS [rows],
SUM(CONVERT(bigint, reserved)) * 8 AS reserved,
SUM(CONVERT(bigint, dpages)) * 8 AS data,
SUM(CONVERT(bigint, used) - CONVERT(bigint, dpages)) * 8 AS index_size,
SUM(CONVERT(bigint, reserved) - CONVERT(bigint, used)) * 8 AS unused
FROM sysindexes WITH (NOLOCK)
WHERE sysindexes.indid IN (0, 1, 255)
AND sysindexes.id > 100
AND object_name(sysindexes.id) <> 'dtproperties'
GROUP BY sysindexes.id WITH ROLLUP) AS X
ORDER BY X.[name]
the problem is that the sum of all tables is not the same size when i make a full database backup.
example of this is when i run this query against my database i see a sum of 111,899 KB that they are 111MB,but when
i do full backup to that database the size of this full backup is 1.5GB,why is that and where this size come from?
THX
Here are my scenarios:
We have an application with replicated environment setup on sql server 2012 . Users will have a replica on their machines and they will replicate to the master database. It has 3 subscriptions subscribed to the publications on the master db.
1) We set up a replica(which uses sql server 2012) on a machine with no sql server on it. After the initial synchronization(used replmerge tool) the mdf file has grown to 33gigs and ldf has grown to 41 gigs. I went to sql server management studion . Right click and checked the properties of the local database. over all size is around 84 gb with little empty free space available.
2) We set up a replica(which uses sql server 2012) on a machine with sql server 2008 on it. After the initial synchronization(used replmerge tool) the mdf file has grown to 49 gigs and ldf has grown to 41 gigs. I went to sql server management studio , Right click and checked the properties of the local database. over all size is around 90 gb with 16 gb free space available.
3) We set up a replica(which uses sql server 2012) on a machine with sql server 2012 on it. We have dropped the local database and recreated the local db and did the initial synchronization using replmerge tool. The mdf file has grown to 49 gigs and ldf has grown to 41 gigs. I went to sql server management studio , Right click and checked the properties of the local database. over all size is around 90 gb with 16 gb free space available.
Why it is allocating the space differently? This is effecting our initial replica set up times.
Ever store a word document in a sql table...? Just wondering how you did it...
Thanks!
Dean
DECLARE @url VARCHAR(1000)
SET @url ='http://www.microsoft.com/technet/security/bulletin/ms11-022.mspx';
How to get the result like 'ms11-022.mspx'
I have Sql Server 2000 and Word from Office Xp. Since a few weeks, I cannotimport Data from my database towards a Word document. I follow theprocedure, but at the end, it tells me Word cannot find the data source. IfI use Excel, well it works perfectly. What is the gig?thanks
View 5 Replies View RelatedHi,
Can anyone assist me to convert .rdl files into an word file ?
Shall i need to write a program ??
Regards
Harsh
Can anyone find what is wrong with this? I think I am using the keyword "Like" correctly. I am trying to enforce some rules by doing this this way. No obvious typos or syntax errors are jumping out at me.
CREATE DATABASE VetClinic
ON
(NAME='VetClinic',
FILENAME = 'c:Program FilesMicrosoft SQL ServerMSSQL.1mssqldataVetClinic.mdf',
SIZE = 100MB,
MAXSIZE = 500MB,
FILEGROWTH = 10MB)
LOG ON
(NAME = 'VetClinicLog',
FILENAME = 'c:Program FilesMicrosoft SQL ServerMSSQL.1mssqldataVetClinic.ldf',
SIZE = 5MB,
MAXSIZE = 25MB,
FILEGROWTH = 5MB)
GO
CREATE TABLE Customers
(
CustID int IDENTITY NOT NULL PRIMARY KEY,
FirstName varchar(15) NOT NULL,
LastName varchar(15) NOT NULL,
StreetAddress varchar(25) NOT NULL,
City varchar(20) NOT NULL,
CustState char(2) NOT NULL,
Zip varchar(10) NOT NULL,
Phone1 char(13) NOT NULL
LIKE "([0-9][0-9][0-9]) [0-9][0-9][0-9]-[0-9][0-9][0-9][0-9]",
Phone2 char(13) NULL
LIKE "([0-9][0-9][0-9]) [0-9][0-9][0-9]-[0-9][0-9][0-9][0-9]",
Email varchar(30) NULL,
DateInSystem smalldatetime NOT NULL
DEFAULT GETDATE()
)
GO
CREATE TABLE PetDetails
(
PetID int IDENTITY NOT NULL PRIMARY KEY,
CustID int NOT NULL
FOREIGN KEY REFERENCES Customers(CustID),
PetName varchar(20) NOT NULL,
BreedID int NOT NULL,
Gender char(1) NOT NULL
LIKE "m" OR "f",
Weight decimal NOT NULL,
DOB smalldatetime NULL,
DateFixed smalldatetime NULL,
DateLastSeen smalldatetime NULL,
VetLastSeen int NULL
)
GO
CREATE TABLE Employees
(
EmpID int IDENTITY NOT NULL PRIMARY KEY,
PositionID int NOT NULL
FOREIGN KEY REFERENCES Positions(PositionID),
FirstName varchar(15) NOT NULL,
LastName varchar(15) NOT NULL,
SSN char(11) NOT NULL
LIKE "[0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9][0-9][0-9]",
StreetAddress varchar(25) NOT NULL,
City varchar(20) NOT NULL,
CustState char(2) NOT NULL,
Zip varchar(10) NOT NULL,
Phone1 char(13) NOT NULL
LIKE "([0-9][0-9][0-9]) [0-9][0-9][0-9]-[0-9][0-9][0-9][0-9]",
Phone2 char(13) NULL
LIKE "([0-9][0-9][0-9]) [0-9][0-9][0-9]-[0-9][0-9][0-9][0-9]",
Email varchar(30) NULL,
DateInSystem smalldatetime NOT NULL
DEFAULT GETDATE(),
HireDate smalldatetime NOT NULL,
TerminationDate smalldatetime NOT NULL,
PaySatus char(6) NOT NULL
LIKE "hourly" OR "salary",
PayAmount money NOT NULL
)
GO
CREATE TABLE Appointment
(
ApptID int IDENTITY NOT NULL PRIMARY KEY,
EmpID int NOT NULL,
ApptDate smalldatetime NOT NULL,
ApptTime smalldatetime NOT NULL,
PetID int NOT NULL,
CustID int NOT NULL,
)
GO
CREATE TABLE PetProcedures
(
ProcedureID int IDENTITY NOT NULL PRIMARY KEY,
ProcedureDescrip varchar(20) NOT NULL,
Cost money NOT NULL
)
GO
CREATE TABLE Breed
(
BreedID int IDENTITY NOT NULL PRIMARY KEY,
BreedName varchar(20) NOT NULL
)
GO
CREATE TABLE Prescriptions
(
PrescriptionID int IDENTITY NOT NULL PRIMARY KEY,
PetID int NOT NULL,
MedID int NOT NULL,
EmpID int NOT NULL,
DatePrescribed smalldatetime NOT NULL
)
GO
CREATE TABLE Medications
(
MedID int IDENTITY NOT NULL PRIMARY KEY,
MedName varchar(30) NOT NULL,
MedType varchar(20) NOT NULL,
Dosage varchar(20) NULL,
Frequency varchar(10) NOT NULL
LIKE "daily", "weekly", "monthly" OR "annually"
)
GO
CREATE TABLE Positions
(
PositionID int IDENTITY NOT NULL PRIMARY KEY,
PositionName varchar(20) NOT NULL
LIKE "vet", "tech", "front desk" OR "office manager"
)
- -----------------------------------------------------------------------------------------------------------------
Here are the errors that I got
Msg 156, Level 15, State 1, Line 12
Incorrect syntax near the keyword 'LIKE'.
Msg 156, Level 15, State 1, Line 10
Incorrect syntax near the keyword 'LIKE'.
Msg 156, Level 15, State 1, Line 10
Incorrect syntax near the keyword 'LIKE'.
Msg 156, Level 15, State 1, Line 9
Incorrect syntax near the keyword 'LIKE'.
Msg 156, Level 15, State 1, Line 6
Incorrect syntax near the keyword 'LIKE'.
It is possible to find table size and in that table each row size.
View 4 Replies View RelatedHi there, i need to know how to cut a string to the nearest word. For example, i've got an article and i need to extract just a part of the beginning, i could use LEFT([content], 250) but there is little chance this will cut on a word. Therefore i need to know if there is a function that will cut to the nearest word in T-SQL or i will simply put a summary field in the database. (I prefer to generate the summary on the fly if possible)
View 3 Replies View RelatedI need to be able to search article in several tables in a MSSQL DB. What is the best way to do a word search? Are there and freebies out there or code examples?
Dave
Is there a function how I can see how many caracters a word from my sql is?
for example:
if I want the lenght of the word "sql" => 3
if I want the lenght of the word "forum" => 5
Hi,
I was hoping somone could help. I need to count the number of words in a specfic column in a table if i didn't know what the words said.
I can count the number of words using
DECLARE @String VARCHAR(4000)
SET @String = ' words to be counted'
SELECT LEN(@String) - LEN(REPLACE(@String, ' ', '')) + 1
AS Results
but this requires me to know what the words are and not count them from the column.
Not sure if i am in the right forum or not.
I have been given the task to create a mail merge application.
For time sakes while this is being built i need to just export the name and address in to a pre written letter in word. how can i do this?