Tuesday, March 20, 2012
[varchar] (100) and empty space
I am creating the following table
CREATE TABLE [dbo].[myT] (
[name] [varchar] (100) NULL
)
if I do
INSERT INTO myT (name) VALUES ('A')
i get in the table a column with
A ...
the 100 char place is full even if there is a data with only 1 char
how is it possible to avoid it ?
I want 100 char maximum but not full with nothing
thank you for helpingWhat do you get when you run this?:
select len([Name]), '[' + [Name] + ']' from myT
Name is a reserved word, and so it is not a good label for a column, but I don't think this would cause the problem you are seeing.|||the 100 char place is full even if there is a data with only 1 charHow do you know?
Could this be a display issue of whatever client program you use to display the data?
Only CHAR columns are padded to the full length not VARCHAR columns|||I know it when I fill a formula with datas I am getting 99 empty spaces
blindman it is an exemple i have no column named [name]
if i run select datalength(name) from myT
i am getting 200 2 times (100)|||Strange I just ran all the scripts above & everything looks good to me
I get 1 from select datalength(name) from myT
anselme
take a deep breath reboot and start running these scripts again
If this does'nt work
Reply here and
stop using the word Char as in the 100 char place is full even if there is a data with only 1 char
explain what query editor you are using
explain what database you are using
run the script exactly as blindman suggests select len([Name]), '[' + [Name] + ']' from myT and tell us exactly the output
GW|||blindman it is an exemple i have no column named [name]You have some sort of typo, and if you expect any more help on this you need to post the actual code so we don't waste more of our time.|||I know it when I fill a formula with datas I am getting 99 empty spacesSQL Server does not have "formulas" to be "filled" (whatever that should mean).
What exactly are you doing?|||i agree with Gwilliy everything looks cool for me too....
varchar will only occupy the required number of space...
however if still problems persist you can always use LTRIM and RTRIM to get rid of the remaining whitespaces
so your query will be something like
select LTRIM(RTRIM([name])) from myT
thats the most we can get you....
However the fact that the 100 varchar place is full still mystifies me|||However the fact that the 100 varchar place is full still mystifies me
I suspect this is a front end issue.
What is this "formula" thing he is filling in?
Monday, March 19, 2012
[SQL2005] Binding defaults without using sp_bindefault
version and the DEFAULT keyword should be used with CREATE TABLE or ALTER
TABLE statements. But I seem to have run into a situation where that only th
e
stored procedure approach works.
script 1:
CREATE DEFAULT abc AS 1
script 2:
CREATE TABLE xyz(
id int IDENTITY(1,1) NOT NULL,
thingy int DEFAULT abc)
This will result in the following error: "The name "abc" is not permitted in
this context. Valid expressions are constants, constant expressions, and (in
some contexts) variables. Column names are not permitted."
It works perfectly when I use the sp_bindefault procedure instead, so I do
have a solution, but can it be done without? I am probably missing something
very simple, so any help is welcome. TIA!Check documentation for CREATE DEFAULT and you will see that this will also
disappear. What BOL is
trying to say is that default objects will disappear, while default constrai
nts is the way to go.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"PaulSand" <PaulSand@.discussions.microsoft.com> wrote in message
news:F6F545C2-D304-46BA-A5D4-DC07660BAECE@.microsoft.com...
> The SQL2005 documentation states the sp_bindefault will be gone in the nex
t
> version and the DEFAULT keyword should be used with CREATE TABLE or ALTER
> TABLE statements. But I seem to have run into a situation where that only
the
> stored procedure approach works.
> script 1:
> CREATE DEFAULT abc AS 1
> script 2:
> CREATE TABLE xyz(
> id int IDENTITY(1,1) NOT NULL,
> thingy int DEFAULT abc)
> This will result in the following error: "The name "abc" is not permitted
in
> this context. Valid expressions are constants, constant expressions, and (
in
> some contexts) variables. Column names are not permitted."
> It works perfectly when I use the sp_bindefault procedure instead, so I do
> have a solution, but can it be done without? I am probably missing somethi
ng
> very simple, so any help is welcome. TIA!
>
>
>|||Don't bind defaults, ADD them:
alter table <table name>
add constraint abc
default (1)
for <column name>
ML
http://milambda.blogspot.com/|||I could do that, but the whole idea for me was to define a centralized
default, so when I change that, the changes will be reflected in every colum
n
binded to that default.
"ML" wrote:
> Don't bind defaults, ADD them:
> alter table <table name>
> add constraint abc
> default (1)
> for <column name>
>
> ML
> --
> http://milambda.blogspot.com/|||Is it possible to bind a single default constraint to multiple columns in
multiple tables? I.e. I have a date column in every table which should be
filled with a default value if none is provided.
At the moment I made a default for it and linked the name of the default to
the date column. In my database design tool, I only have to change the
default value in one place if I ever decide the current one is not right
anymore. Let the tool create a script for me and it is changed.
With constraints I have to change the default value in every single table
(200+), while I could do it with just one simple change when using
sp_bindefault was allowed. Or can it be done more easily?
"Tibor Karaszi" wrote:
> Check documentation for CREATE DEFAULT and you will see that this will als
o disappear. What BOL is
> trying to say is that default objects will disappear, while default constr
aints is the way to go.
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
> Blog: http://solidqualitylearning.com/blogs/tibor/
>
> "PaulSand" <PaulSand@.discussions.microsoft.com> wrote in message
> news:F6F545C2-D304-46BA-A5D4-DC07660BAECE@.microsoft.com...
>|||As Tibor states in his post the default as a SQL object is on its last breat
h
(so to speak), as for the default as a constraint it cannot be reused as if
it were an object.
A constraint is a declaration, and if your requirement really is
object-oriented (rather than declarative) then maybe you could get what you
need by using a user-defined CLR type. But only for a default? I wouldn't go
down that road.
While being aware of the benefits a default provides as an object (e.g.
reusability), I still think a default is merely an attribute of the
individual column, and should be treated as such - kept in the meta world.
ML
http://milambda.blogspot.com/|||Ah hold on, I know what to do ;-)
Currently I have a UDDT for a mandatory date column and bind a default to it
when I need to. The solution is to create two UDDTs, one with and one withou
t
the constraint. It's gonna be some work to convert 200+ tables, but it's a
solution ...
"PaulSand" wrote:
> Is it possible to bind a single default constraint to multiple columns in
> multiple tables? I.e. I have a date column in every table which should be
> filled with a default value if none is provided.
> At the moment I made a default for it and linked the name of the default t
o
> the date column. In my database design tool, I only have to change the
> default value in one place if I ever decide the current one is not right
> anymore. Let the tool create a script for me and it is changed.
> With constraints I have to change the default value in every single table
> (200+), while I could do it with just one simple change when using
> sp_bindefault was allowed. Or can it be done more easily?
>
> "Tibor Karaszi" wrote:
>|||Oops, sorry for making a mess here, but that isn't a solution either ...
"PaulSand" wrote:
> Ah hold on, I know what to do ;-)
> Currently I have a UDDT for a mandatory date column and bind a default to
it
> when I need to. The solution is to create two UDDTs, one with and one with
out
> the constraint. It's gonna be some work to convert 200+ tables, but it's a
> solution ...
> "PaulSand" wrote:
>|||Mess? Aren't we learning anymore? :)
ML
http://milambda.blogspot.com/|||> Is it possible to bind a single default constraint to multiple columns in
> multiple tables?
No. In short:
Default objects are deprecated. Those does what you want to do.
Default constraints are supported and recommended way in the future. But you
create them at the
column level, so they cannot be defined-one-used-many.
You might want to post a wish to [url]http://lab.msdn.microsoft.com/productfeedback/.[/
url] The ANSI SQL
feature you are looking for is the "DOMAIN" (CREATE/ALTER DOMAIN), but that
is not implemented in
SQL Server.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"PaulSand" <PaulSand@.discussions.microsoft.com> wrote in message
news:6D87E279-5C8F-4BB6-9394-28454BD4B89D@.microsoft.com...
> Is it possible to bind a single default constraint to multiple columns in
> multiple tables? I.e. I have a date column in every table which should be
> filled with a default value if none is provided.
> At the moment I made a default for it and linked the name of the default t
o
> the date column. In my database design tool, I only have to change the
> default value in one place if I ever decide the current one is not right
> anymore. Let the tool create a script for me and it is changed.
> With constraints I have to change the default value in every single table
> (200+), while I could do it with just one simple change when using
> sp_bindefault was allowed. Or can it be done more easily?
>
> "Tibor Karaszi" wrote:
>
Sunday, March 11, 2012
[SQL 2005 Express] Question on Business Intelligence Development Studio (VS2005)
In Pivot Table, I can change the presentation of the data area to align with row or column, just like this:
http://img164.imageshack.us/img164/2055/untitledsi4.png
However, I can't seem to do that in BI Development Studio while designing the report. Does any of you know how to change the presentation of the data area of a report?
This is how it looks like now, the data area is sticking to the COLUMN, but I need them to stick with ROW so that I can handle more columns...
http://img103.imageshack.us/img103/4066/untitlednc8.pngmanage to resolve it by inserting just 1 details, then insert "Add ROW" at the details. This thing doesn't come with the Wizard. :D
[Reports builder] operator * in a prompt list
Hi all, when i create a reports deploy on the Report server, i usually choose a filter prompted on Run. The lsit containt for example the list of my customers, but the list in empty like i want (like that, user can put a list from excel by copy-paste). But ... , if the want all the customers, what is the " * " operator to select all my records ?
Thanks for help
Erwan, France
Do you meanIn a drop down for a report parameter you want <all> to appear?
Thursday, March 8, 2012
[newbie] Execute SQL task bypassed, why ?
I meet a strange behaviour which is probably caused by my SSIS newbie nature.
I have a Execute SQL Task, used to drop and create some temporary tables. It works when invoked manually.
I have chained a Data Flow Task behind, but when I launch the whole process, although the Execute SQL tasks goes green, it is not executed (then the Data Flow fails because the required tables are missing).
Would anyone have any hint on why the execute sql task seems to be bypassed ?
kind regards
Thibaut
hi Thibaut,
how odd! Have you defined a log file for your package? If so, what kind of info is providing to you?
|||Is that a package that you strated from scratch? If not; make sure there is not an expression or package configuration that changes the SQL Statement or the connection strings. If you are getting green on the SQL task I bet the object is actually being created, perhaps in the wrong side (server, schema, DB, etc)
Rafael Salas
|||I am now restarting the package from scratch, and making it configurable ("keeping it in the dark"). I'll report back if I meet the same issue again.thanks!|||Hi!
I finally found out what is happening. The Data flow task is using a XML source to load the data into tables which are created by the Execute SQL task.
The XML source was trying to validate the schema provided at run time against tables which are not created yet... I just disabled the validation on the XML source and everything went fine.
thanks for all the replies.
cheers!
Thibaut
Tuesday, March 6, 2012
[Named Pipes]Specified Sql server not found]
rror on some of the machine, but on some of the machine it is working fine.
All client machine having W2K Prof.
"[Microsoft[[ODBC Sql Server Driver][Named Pipes]Specified S
ql server not found"
Server alias/client using TCP/IP utility. Earlier it was working fine on all
the machine. I only installed Sql Server SP3a, after that it is starting gi
vig the problem.
Let me khow do I handle this.
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.693 / Virus Database: 454 - Release Date: 05/31/2004I sort out the problem, by installing MDAC 2.8. Now it is working fine.
"Ashish Kanoongo" <ashishk@.armour.com> wrote in message news:OwSuidHSEHA.139
2@.TK2MSFTNGP09.phx.gbl...
I am trying to create Sql Server 2000 remotely using and getting following e
rror on some of the machine, but on some of the machine it is working fine.
All client machine having W2K Prof.
"[Microsoft[[ODBC Sql Server Driver][Named Pipes]Specified S
ql server not found"
Server alias/client using TCP/IP utility. Earlier it was working fine on all
the machine. I only installed Sql Server SP3a, after that it is starting gi
vig the problem.
Let me khow do I handle this.
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.693 / Virus Database: 454 - Release Date: 05/31/2004|||Get the actual OS Error number. Example if the Error is 53, then the error
is Network Name not Found. Usually a WINS issue.
Test with a ODBC DSN to get the entire error message and re-post it here.
Thanks,
Kevin McDonnell
Microsoft Corporation
This posting is provided AS IS with no warranties, and confers no rights.
[Named Pipes]Specified Sql server not found]
"[Microsoft[[ODBC Sql Server Driver][Named Pipes]Specified Sql server not found"
Server alias/client using TCP/IP utility. Earlier it was working fine on all the machine. I only installed Sql Server SP3a, after that it is starting givig the problem.
Let me khow do I handle this.
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.693 / Virus Database: 454 - Release Date: 05/31/2004
I sort out the problem, by installing MDAC 2.8. Now it is working fine.
"Ashish Kanoongo" <ashishk@.armour.com> wrote in message news:OwSuidHSEHA.1392@.TK2MSFTNGP09.phx.gbl...
I am trying to create Sql Server 2000 remotely using and getting following error on some of the machine, but on some of the machine it is working fine. All client machine having W2K Prof.
"[Microsoft[[ODBC Sql Server Driver][Named Pipes]Specified Sql server not found"
Server alias/client using TCP/IP utility. Earlier it was working fine on all the machine. I only installed Sql Server SP3a, after that it is starting givig the problem.
Let me khow do I handle this.
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.693 / Virus Database: 454 - Release Date: 05/31/2004
|||Get the actual OS Error number. Example if the Error is 53, then the error
is Network Name not Found. Usually a WINS issue.
Test with a ODBC DSN to get the entire error message and re-post it here.
Thanks,
Kevin McDonnell
Microsoft Corporation
This posting is provided AS IS with no warranties, and confers no rights.
[MS Sql] Data type nvarchar
I'm using SQL Server Management Studio Express.
I'm trying to create a field which contains a text entered by the user. So, it should be able to contain at least 500 characters.
I used the type "nvarchar(MAX)". The problem is that the type contains about 50 characters max!!
I couldn't find out where and how to fix that.
If you have any idea :)
Thanks a lotType over the the MAX with the desired length of 500.|||Hi tmorton
Of course I tried nvarchar(500) (forgot to tell that). But it's not working either.
It sounds like nvarchar(MAX) is the max length type, and limited to about 50...
Thanks for your reply. And if someone has any idea :)|||That's all it takes from the SQL Server end. If you are only managing to store 50 characters in that column, then I would venture a guess that your data is being truncated before it hits the database. What does your code look like that is adding the data to your table?|||I believe that SQL Management Studio truncates text that it displays. Use something else to view/edit the column.|||Hi
It's weird, it's working now. And yet I didn't change anything particular. Maybe a "bug" on SQL Server... weird though. Thanks a lot to you guys :)
Saturday, February 25, 2012
[Microsoft][ODBC SQL Server Driver][SQL Server]Invalid object name
Please assist fellas - situation critical.
Thanx.Refer to this KBA (http://support.microsoft.com/default.aspx?scid=http://support.microsoft.com:80/support/kb/articles/Q218/9/95.asp&NoWebContent=1) to resolve the issue.|||Thanx for the info but it didn't work.|||If you created the objects as the user, then they are owned by the user, and will be named [ownername].[objectname].
If your sql code does not specify a ownername sqlserver assumes dbo ownership, and your objects don't exists as dbo.[objectname].
Either specify the owner name when you reference the objects,
or instead of granting all individual rights to the user just grant it dbo access to the database. Then any objects it creates will be dbo owned and will not need to be fully referenced.
blindman
Thursday, February 16, 2012
[database_name . [schema_name ] . | schema_name . ] table_name
I try to create 2 schema as the syntax display's as below, but I get a error
of only use 1. Do I have to change any parameters in SQL 2005?
And will I get any other problems in the future to use 2 schema?
Syntax
CREATE TABLE
[ database_name . [ schema_name ] . | schema_name . ] table_name> Hi,
> I try to create 2 schema as the syntax display's as below, but I get a
> error
> of only use 1.
Can you show the ACTUAL syntax you tried, and the EXACT error message?
The syntax you show demonstrates two options:
CREATE TABLE master.schema1.table
CREATE TABLE schema1.table
It sounds like you maybe misinterpreted it as:
CREATE TABLE master.schema1.schema2.table
?
> Do I have to change any parameters in SQL 2005?
> And will I get any other problems in the future to use 2 schema?
> Syntax
> CREATE TABLE
> [ database_name . [ schema_name ] . | schema_name . ] table_name|||The schema concept is not hierarchical. An object is contained in a schema,
not a level of schemas.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"RBC" <RBC@.discussions.microsoft.com> wrote in message
news:DD3B310F-B41C-45E5-AEC9-C5F2DD1A12C4@.microsoft.com...
> Hi,
> I try to create 2 schema as the syntax display's as below, but I get a err
or
> of only use 1. Do I have to change any parameters in SQL 2005?
> And will I get any other problems in the future to use 2 schema?
> Syntax
> CREATE TABLE
> [ database_name . [ schema_name ] . | schema_name . ] table_name
[database_name . [schema_name ] . | schema_name . ] table_na
Create Schema.TableName (No Problem)
Create Schema1.schema2.TableName (Problem SQL see schema1 as the database)
Create Database,schema1.schema2.TableName (Error below)
Msg 117, Level 15, State 1, Line 13
The object name 'DatabasName.Schema1. Schema2.TableName' contains more than
the maximum number of prefixes. The maximum is 2.
Msg 319, Level 15, State 1, Line 84
Incorrect syntax near the keyword 'with'. If this statement is a common
table expression or an xmlnamespaces clause, the previous statement must be
terminated with a semicolon.
"Aaron Bertrand [SQL Server MVP]" wrote:
> Can you show the ACTUAL syntax you tried, and the EXACT error message?
> The syntax you show demonstrates two options:
> CREATE TABLE master.schema1.table
> CREATE TABLE schema1.table
> It sounds like you maybe misinterpreted it as:
> CREATE TABLE master.schema1.schema2.table
> ?
>
>
>> Create Schema1.schema2.TableName (Problem SQL see schema1 as the database)
Yes, because you can't nest schemas.
> Create Database,schema1.schema2.TableName (Error below)
You still can't nest schemas. A schema can't own a schema, there is only
one "level" for it in the heirarchy.|||You can nest schemas according to the syntax. Do you claim the syntax is wro
ng?
Syntax
CREATE TABLE
[ database_name . [ schema_name ] . | schema_name . ] table_name
"Aaron Bertrand [SQL Server MVP]" wrote:
> Yes, because you can't nest schemas.
>
> You still can't nest schemas. A schema can't own a schema, there is only
> one "level" for it in the heirarchy.
>
>|||> You can nest schemas according to the syntax. Do you claim the syntax is
> wrong?
> Syntax
> CREATE TABLE
> [ database_name . [ schema_name ] . | schema_name . ] table_name
No, the syntax is not wrong. Your interpretation of the syntax is wrong, as
several people have already pointed out.
The syntax says you can do:
CREATE TABLE databasename.schemaname.tablename
or
CREATE TABLE schemaname.tablename
or
CREATE TABLE tablename
[[this.that]|or this but not both.]tablename
Go ahead and file a bug that the documentation is wrong as per your
interpretation. But the following fact remains the same: YOU CANNOT NEST
SCHEMAS, EVEN IF YOU INTERPRET THE DOCUMENTATION INCORRECTLY.|||I think you only have to change the parameter from 2 to 3 (Error message),
and we are fine.
I found 1 person by searching the Internet who had the error 3, who tried to
write 3 schemas by including dbo in his syntax...
Thank you,
Rune
"Aaron Bertrand [SQL Server MVP]" wrote:
> No, the syntax is not wrong. Your interpretation of the syntax is wrong,
as
> several people have already pointed out.
> The syntax says you can do:
> CREATE TABLE databasename.schemaname.tablename
> or
> CREATE TABLE schemaname.tablename
> or
> CREATE TABLE tablename
> [[this.that]|or this but not both.]tablename
> Go ahead and file a bug that the documentation is wrong as per your
> interpretation. But the following fact remains the same: YOU CANNOT NEST
> SCHEMAS, EVEN IF YOU INTERPRET THE DOCUMENTATION INCORRECTLY.
>
>|||>I think you only have to change the parameter from 2 to 3 (Error message),
> and we are fine.
> I found 1 person by searching the Internet who had the error 3, who tried
> to
> write 3 schemas by including dbo in his syntax...
Now I have absolutely no idea what you are talking about.
In summary: YOU CANNOT NEST SCHEMAS.
Monday, February 13, 2012
[2005] How do I script out all indexes?
we are using Sql Server 2005 Managament Studio.
Can someone tell me how I can script out all DROP/CREATE INDEXES for a particular database?
We only want to script out the INDEXES, not the tables.
Please advise.
Thanks.
`LeYou can try using a (free) tool I wrote, called scriptdb.exe.
It scripts out all objects (including indexes). The script for each object is created in a separate file. It would be a simple matter to alter the tool so it only scripts the indexes (the source is available so you could do it yourself). Or you can just run it as is and script out all the objects, and throw away what you don't want if all you care about are indexes.
You can get it here: http://www.elsasoft.org/tools.htm
Alternatively, in SSMS, you could try using the Generate Scripts Wizard for this, but it won't do both drop and create at the same time. only drop OR create. not both.
Hope this helps!|||Thanks for the offer, but my company has a policy against 3rd party executables.
As for Sql Server Management Studio, I cannot seem to find anyplace to script out ONLY the indexes.
Are there other suggestions?
`Le|||you appear to be right, GSW won't script the index separate from the table.
even if you have a policy against 3rd party executables, you can still use scriptdb since I posted the source code.
Just build it yourself using VS or csc.exe and then it's *your* executable ;)
[2005 beta 2] merge replication sql server to sql server mobile
the main subject of my problem is, that i want to create a mobile
database from a server database on the server. Sql server 2005 supports
this, but it doesn't work.
I created a publication for merge replication in my server database, but
when i try to subscribe from my mobile database, i get the following error:
################################################## ######################
- Beginning Synchronization (Success)
- Synchronizing Data (100%) (Error)
Messages
Initializing SQL Server Reconciler has failed.
HRESULT 0x80045003 (29045)
The initial snapshot for publication 'PUBLICATIONNAME' is not yet
available. Start the Snapshot Agent to generate the snapshot for this
publication. If this snapshot is currently being generated, wait for the
process to complete and restart the synchronization.
HRESULT 0x80045003 (0)
The operation could not be completed.
- Finalizing Synchronization (Stopped)
- Saving Subscription Properties (Stopped)
################################################## ######################
But I am not able to generate a snapshot. When I use the "Generate
snapshot" option in the context menu of my publication, it only
generates a .bnc file of one of the tables i want to replicate in the
replication folder.
And I don't know whats the right argument for "distributor" to run the
snapshot agent manually (snapshot.exe). I thought its the server, but
doesn't work.
Has anybody an idea, wheres my failure? Does anybody get something like
this to work and can give a short howto?
Best regards
Diemo
You will probably have better luck in the beta newsgroups.
http://www.aspfaq.com/sql2005/show.asp?id=1
"dieweb" <dawinci@.wh20.tu-dresden.de> wrote in message
news:30chlqF2v7b8kU1@.uni-berlin.de...
> Hello,
> the main subject of my problem is, that i want to create a mobile
> database from a server database on the server. Sql server 2005 supports
> this, but it doesn't work.
> I created a publication for merge replication in my server database, but
> when i try to subscribe from my mobile database, i get the following
error:
> ################################################## ######################
> - Beginning Synchronization (Success)
> - Synchronizing Data (100%) (Error)
> Messages
> Initializing SQL Server Reconciler has failed.
> HRESULT 0x80045003 (29045)
> The initial snapshot for publication 'PUBLICATIONNAME' is not yet
> available. Start the Snapshot Agent to generate the snapshot for this
> publication. If this snapshot is currently being generated, wait for the
> process to complete and restart the synchronization.
> HRESULT 0x80045003 (0)
> The operation could not be completed.
>
> - Finalizing Synchronization (Stopped)
> - Saving Subscription Properties (Stopped)
> ################################################## ######################
> But I am not able to generate a snapshot. When I use the "Generate
> snapshot" option in the context menu of my publication, it only
> generates a .bnc file of one of the tables i want to replicate in the
> replication folder.
> And I don't know whats the right argument for "distributor" to run the
> snapshot agent manually (snapshot.exe). I thought its the server, but
> doesn't work.
> Has anybody an idea, wheres my failure? Does anybody get something like
> this to work and can give a short howto?
> Best regards
> Diemo
[2005 beta 2] merge replication sql server to sql server mobile
the main subject of my problem is, that i want to create a mobile
database from a server database on the server. Sql server 2005 supports
this, but it doesn't work.
I created a publication for merge replication in my server database, but
when i try to subscribe from my mobile database, i get the following error:
################################################## ######################
- Beginning Synchronization (Success)
- Synchronizing Data (100%) (Error)
Messages
Initializing SQL Server Reconciler has failed.
HRESULT 0x80045003 (29045)
The initial snapshot for publication 'PUBLICATIONNAME' is not yet
available. Start the Snapshot Agent to generate the snapshot for this
publication. If this snapshot is currently being generated, wait for the
process to complete and restart the synchronization.
HRESULT 0x80045003 (0)
The operation could not be completed.
- Finalizing Synchronization (Stopped)
- Saving Subscription Properties (Stopped)
################################################## ######################
But I am not able to generate a snapshot. When I use the "Generate
snapshot" option in the context menu of my publication, it only
generates a .bnc file of one of the tables i want to replicate in the
replication folder.
And I don't know whats the right argument for "distributor" to run the
snapshot agent manually (snapshot.exe). I thought its the server, but
doesn't work.
Has anybody an idea, wheres my failure? Does anybody get something like
this to work and can give a short howto?
Best regards
Diemo
You will probably have better luck in the beta newsgroups.
http://www.aspfaq.com/sql2005/show.asp?id=1
"dieweb" <dawinci@.wh20.tu-dresden.de> wrote in message
news:30chlqF2v7b8kU1@.uni-berlin.de...
> Hello,
> the main subject of my problem is, that i want to create a mobile
> database from a server database on the server. Sql server 2005 supports
> this, but it doesn't work.
> I created a publication for merge replication in my server database, but
> when i try to subscribe from my mobile database, i get the following
error:
> ################################################## ######################
> - Beginning Synchronization (Success)
> - Synchronizing Data (100%) (Error)
> Messages
> Initializing SQL Server Reconciler has failed.
> HRESULT 0x80045003 (29045)
> The initial snapshot for publication 'PUBLICATIONNAME' is not yet
> available. Start the Snapshot Agent to generate the snapshot for this
> publication. If this snapshot is currently being generated, wait for the
> process to complete and restart the synchronization.
> HRESULT 0x80045003 (0)
> The operation could not be completed.
>
> - Finalizing Synchronization (Stopped)
> - Saving Subscription Properties (Stopped)
> ################################################## ######################
> But I am not able to generate a snapshot. When I use the "Generate
> snapshot" option in the context menu of my publication, it only
> generates a .bnc file of one of the tables i want to replicate in the
> replication folder.
> And I don't know whats the right argument for "distributor" to run the
> snapshot agent manually (snapshot.exe). I thought its the server, but
> doesn't work.
> Has anybody an idea, wheres my failure? Does anybody get something like
> this to work and can give a short howto?
> Best regards
> Diemo
|||Hi Diemo
I am facing the same problem...check the newsgroup and could not find any answers. Could u help me. Many thanks.
Regards
Danny Cheah
Malaysia.
Quote:
Hello,
the main subject of my problem is, that i want to create a mobile
database from a server database on the server. Sql server 2005 supports
this, but it doesn't work.
I created a publication for merge replication in my server database, but
when i try to subscribe from my mobile database, i get the following error:
################################################## ######################
- Beginning Synchronization (Success)
- Synchronizing Data (100%) (Error)
Messages
Initializing SQL Server Reconciler has failed.
HRESULT 0x80045003 (29045)
The initial snapshot for publication 'PUBLICATIONNAME' is not yet
available. Start the Snapshot Agent to generate the snapshot for this
publication. If this snapshot is currently being generated, wait for the
process to complete and restart the synchronization.
HRESULT 0x80045003 (0)
The operation could not be completed.
- Finalizing Synchronization (Stopped)
- Saving Subscription Properties (Stopped)
################################################## ######################
But I am not able to generate a snapshot. When I use the "Generate
snapshot" option in the context menu of my publication, it only
generates a .bnc file of one of the tables i want to replicate in the
replication folder.
And I don't know whats the right argument for "distributor" to run the
snapshot agent manually (snapshot.exe). I thought its the server, but
doesn't work.
Has anybody an idea, wheres my failure? Does anybody get something like
this to work and can give a short howto?
Best regards
Diemo
[2005 beta 2] merge replication sql server to sql server mobile
the main subject of my problem is, that i want to create a mobile
database from a server database on the server. Sql server 2005 supports
this, but it doesn't work.
I created a publication for merge replication in my server database, but
when i try to subscribe from my mobile database, i get the following error:
########################################
################################
- Beginning Synchronization (Success)
- Synchronizing Data (100%) (Error)
Messages
Initializing SQL Server Reconciler has failed.
HRESULT 0x80045003 (29045)
The initial snapshot for publication 'PUBLICATIONNAME' is not yet
available. Start the Snapshot Agent to generate the snapshot for this
publication. If this snapshot is currently being generated, wait for the
process to complete and restart the synchronization.
HRESULT 0x80045003 (0)
The operation could not be completed.
- Finalizing Synchronization (Stopped)
- Saving Subscription Properties (Stopped)
########################################
################################
But I am not able to generate a snapshot. When I use the "Generate
snapshot" option in the context menu of my publication, it only
generates a .bnc file of one of the tables i want to replicate in the
replication folder.
And I don't know whats the right argument for "distributor" to run the
snapshot agent manually (snapshot.exe). I thought its the server, but
doesn't work.
Has anybody an idea, wheres my failure? Does anybody get something like
this to work and can give a short howto?
Best regards
DiemoYou will probably have better luck in the beta newsgroups.
http://www.aspfaq.com/sql2005/show.asp?id=1
"dieweb" <dawinci@.wh20.tu-dresden.de> wrote in message
news:30chlqF2v7b8kU1@.uni-berlin.de...
> Hello,
> the main subject of my problem is, that i want to create a mobile
> database from a server database on the server. Sql server 2005 supports
> this, but it doesn't work.
> I created a publication for merge replication in my server database, but
> when i try to subscribe from my mobile database, i get the following
error:
> ########################################
################################
> - Beginning Synchronization (Success)
> - Synchronizing Data (100%) (Error)
> Messages
> Initializing SQL Server Reconciler has failed.
> HRESULT 0x80045003 (29045)
> The initial snapshot for publication 'PUBLICATIONNAME' is not yet
> available. Start the Snapshot Agent to generate the snapshot for this
> publication. If this snapshot is currently being generated, wait for the
> process to complete and restart the synchronization.
> HRESULT 0x80045003 (0)
> The operation could not be completed.
>
> - Finalizing Synchronization (Stopped)
> - Saving Subscription Properties (Stopped)
> ########################################
################################
> But I am not able to generate a snapshot. When I use the "Generate
> snapshot" option in the context menu of my publication, it only
> generates a .bnc file of one of the tables i want to replicate in the
> replication folder.
> And I don't know whats the right argument for "distributor" to run the
> snapshot agent manually (snapshot.exe). I thought its the server, but
> doesn't work.
> Has anybody an idea, wheres my failure? Does anybody get something like
> this to work and can give a short howto?
> Best regards
> Diemo|||Hi Diemo
I am facing the same problem...check the newsgroup and could not find
any answers. Could u help me. Many thanks.
Regards
Danny Cheah
Malaysia.
dieweb wrote:
> *Hello,
> the main subject of my problem is, that i want to create a mobile
> database from a server database on the server. Sql server 2005
> supports
> this, but it doesn't work.
> I created a publication for merge replication in my server database,
> but
> when i try to subscribe from my mobile database, i get the following
> error:
> ########################################
################################
> - Beginning Synchronization (Success)
> - Synchronizing Data (100%) (Error)
> Messages
> Initializing SQL Server Reconciler has failed.
> HRESULT 0x80045003 (29045)
> The initial snapshot for publication 'PUBLICATIONNAME' is not yet
> available. Start the Snapshot Agent to generate the snapshot for
> this
> publication. If this snapshot is currently being generated, wait for
> the
> process to complete and restart the synchronization.
> HRESULT 0x80045003 (0)
> The operation could not be completed.
>
> - Finalizing Synchronization (Stopped)
> - Saving Subscription Properties (Stopped)
> ########################################
################################
> But I am not able to generate a snapshot. When I use the "Generate
> snapshot" option in the context menu of my publication, it only
> generates a .bnc file of one of the tables i want to replicate in
> the
> replication folder.
> And I don't know whats the right argument for "distributor" to run
> the
> snapshot agent manually (snapshot.exe). I thought its the server,
> but
> doesn't work.
> Has anybody an idea, wheres my failure? Does anybody get something
> like
> this to work and can give a short howto?
> Best regards
> Diemo *
DannyCheah
---
Posted via http://www.mcse.ms
---
View this thread: http://www.mcse.ms/message1239516.html
[2005 beta 2] merge replication sql server to sql server mobile
the main subject of my problem is, that i want to create a mobile
database from a server database on the server. Sql server 2005 supports
this, but it doesn't work.
I created a publication for merge replication in my server database, but
when i try to subscribe from my mobile database, i get the following error:
########################################################################
- Beginning Synchronization (Success)
- Synchronizing Data (100%) (Error)
Messages
Initializing SQL Server Reconciler has failed.
HRESULT 0x80045003 (29045)
The initial snapshot for publication 'PUBLICATIONNAME' is not yet
available. Start the Snapshot Agent to generate the snapshot for this
publication. If this snapshot is currently being generated, wait for the
process to complete and restart the synchronization.
HRESULT 0x80045003 (0)
The operation could not be completed.
- Finalizing Synchronization (Stopped)
- Saving Subscription Properties (Stopped)
########################################################################
But I am not able to generate a snapshot. When I use the "Generate
snapshot" option in the context menu of my publication, it only
generates a .bnc file of one of the tables i want to replicate in the
replication folder.
And I don't know whats the right argument for "distributor" to run the
snapshot agent manually (snapshot.exe). I thought its the server, but
doesn't work.
Has anybody an idea, wheres my failure? Does anybody get something like
this to work and can give a short howto?
Best regards
DiemoYou will probably have better luck in the beta newsgroups.
http://www.aspfaq.com/sql2005/show.asp?id=1
"dieweb" <dawinci@.wh20.tu-dresden.de> wrote in message
news:30chlqF2v7b8kU1@.uni-berlin.de...
> Hello,
> the main subject of my problem is, that i want to create a mobile
> database from a server database on the server. Sql server 2005 supports
> this, but it doesn't work.
> I created a publication for merge replication in my server database, but
> when i try to subscribe from my mobile database, i get the following
error:
> ########################################################################
> - Beginning Synchronization (Success)
> - Synchronizing Data (100%) (Error)
> Messages
> Initializing SQL Server Reconciler has failed.
> HRESULT 0x80045003 (29045)
> The initial snapshot for publication 'PUBLICATIONNAME' is not yet
> available. Start the Snapshot Agent to generate the snapshot for this
> publication. If this snapshot is currently being generated, wait for the
> process to complete and restart the synchronization.
> HRESULT 0x80045003 (0)
> The operation could not be completed.
>
> - Finalizing Synchronization (Stopped)
> - Saving Subscription Properties (Stopped)
> ########################################################################
> But I am not able to generate a snapshot. When I use the "Generate
> snapshot" option in the context menu of my publication, it only
> generates a .bnc file of one of the tables i want to replicate in the
> replication folder.
> And I don't know whats the right argument for "distributor" to run the
> snapshot agent manually (snapshot.exe). I thought its the server, but
> doesn't work.
> Has anybody an idea, wheres my failure? Does anybody get something like
> this to work and can give a short howto?
> Best regards
> Diemo|||Hi Diemo
I am facing the same problem...check the newsgroup and could not fin
any answers. Could u help me. Many thanks.
Regards
Danny Cheah
Malaysia.
dieweb wrote:
> *Hello,
> the main subject of my problem is, that i want to create a mobile
> database from a server database on the server. Sql server 200
> supports
> this, but it doesn't work.
> I created a publication for merge replication in my server database
> but
> when i try to subscribe from my mobile database, i get the followin
> error:
> ########################################################################
> - Beginning Synchronization (Success)
> - Synchronizing Data (100%) (Error)
> Messages
> Initializing SQL Server Reconciler has failed.
> HRESULT 0x80045003 (29045)
> The initial snapshot for publication 'PUBLICATIONNAME' is not yet
> available. Start the Snapshot Agent to generate the snapshot fo
> this
> publication. If this snapshot is currently being generated, wait fo
> the
> process to complete and restart the synchronization.
> HRESULT 0x80045003 (0)
> The operation could not be completed.
>
> - Finalizing Synchronization (Stopped)
> - Saving Subscription Properties (Stopped)
> ########################################################################
> But I am not able to generate a snapshot. When I use the "Generate
> snapshot" option in the context menu of my publication, it only
> generates a .bnc file of one of the tables i want to replicate i
> the
> replication folder.
> And I don't know whats the right argument for "distributor" to ru
> the
> snapshot agent manually (snapshot.exe). I thought its the server
> but
> doesn't work.
> Has anybody an idea, wheres my failure? Does anybody get somethin
> like
> this to work and can give a short howto?
> Best regards
> Diemo
-
DannyChea
----
Posted via http://www.mcse.m
----
View this thread: http://www.mcse.ms/message1239516.htm
[:#] problems viewing the custom sql statement in the gridview control
Hi,
I really need some help trying to figure out why my gridview is not working when I create a custom sql statement. It "executes" the query, but gives me an error message when I "test the query". Here is the error message:"There was an error executing the query. Please check the syntax of the command and if present, the types and values of the parameters and ensure they are correct. Syntax error: Expecting '.', identifier or quoted identifier."
Here is my sql statement:
SELECT TBLPROJECTS.NAME, TBLPROJECTTYPES.NAME AS PROJECTTYPE, TBLPROJECTS.DESCRIPTION, TBLUSERS_1.LOGIN AS OWNERNAME,
TBLUSERS.LOGIN AS MANAGERNAME, TBLPROJECTS.START_DATE, TBLPROJECTS.END_DATE, TBLAOI.NAME AS AREAOFINTEREST,
TBLPROJECTS.MANPOWER, TBLUNITS.NAME AS MANPOWERUNIT
FROM TBLPROJECTS INNER JOIN
TBLAOI ON TBLPROJECTS.AOI_ID = TBLAOI.ID INNER JOIN
TBLPROJECTTYPES ON TBLPROJECTS.PROJECTTYPE_ID = TBLPROJECTTYPES.ID INNER JOIN
TBLUNITS ON TBLPROJECTS.MANPOWERUNITS_ID = TBLUNITS.ID INNER JOIN
TBLUSERS ON TBLPROJECTS.MANAGER_ID = TBLUSERS.ID INNER JOIN
TBLUSERS TBLUSERS_1 ON TBLPROJECTS.OWNER_ID = TBLUSERS_1.ID
I have tested it on a new project and still it does not work, I cannot find any problem, please help!!!!!!!!!!!!!!!!!!!!!!!!
Does the query compile and return results by itself if you execute it in query analyzer?
|||Yes, it compiles in the "Execute Query" in the "Query Builder", but when I click next, and it is supposed to Test the query, it doesnt work. Then it gives me an error when I try to ctrl F5,
DataBinding: 'System.Data.DataRowView' does not contain a property with the name 'ID'.
Description:An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details:System.Web.HttpException: DataBinding: 'System.Data.DataRowView' does not contain a property with the name 'ID'.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.Stack Trace:
[HttpException (0x80004005): DataBinding: 'System.Data.DataRowView' does not contain a property with the name 'ID'.] System.Web.UI.DataBinder.GetPropertyValue(Object container, String propName) +198 System.Web.UI.WebControls.GridView.CreateChildControls(IEnumerable dataSource, Boolean dataBinding) +2775 System.Web.UI.WebControls.CompositeDataBoundControl.PerformDataBinding(IEnumerable data) +59 System.Web.UI.WebControls.GridView.PerformDataBinding(IEnumerable data) +12 System.Web.UI.WebControls.DataBoundControl.OnDataSourceViewSelectCallback(IEnumerable data) +101 System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +25 System.Web.UI.WebControls.DataBoundControl.PerformSelect() +140 System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +68 System.Web.UI.WebControls.GridView.DataBind() +5 System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +61 System.Web.UI.WebControls.CompositeDataBoundControl.CreateChildControls() +67 System.Web.UI.Control.EnsureChildControls() +97 System.Web.UI.Control.PreRenderRecursiveInternal() +50 System.Web.UI.Control.PreRenderRecursiveInternal() +171 System.Web.UI.Control.PreRenderRecursiveInternal() +171 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5731
I hope this helps? Thanks|||
Yes, it compiles in the "Execute Query" in the "Query Builder", but when I click next, and it is supposed to Test the query, it doesnt work. Then it gives me an error when I try to ctrl F5,
DataBinding: 'System.Data.DataRowView' does not contain a property with the name 'ID'.
Description:An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details:System.Web.HttpException: DataBinding: 'System.Data.DataRowView' does not contain a property with the name 'ID'.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.Stack Trace:
[HttpException (0x80004005): DataBinding: 'System.Data.DataRowView' does not contain a property with the name 'ID'.] System.Web.UI.DataBinder.GetPropertyValue(Object container, String propName) +198 System.Web.UI.WebControls.GridView.CreateChildControls(IEnumerable dataSource, Boolean dataBinding) +2775 System.Web.UI.WebControls.CompositeDataBoundControl.PerformDataBinding(IEnumerable data) +59 System.Web.UI.WebControls.GridView.PerformDataBinding(IEnumerable data) +12 System.Web.UI.WebControls.DataBoundControl.OnDataSourceViewSelectCallback(IEnumerable data) +101 System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +25 System.Web.UI.WebControls.DataBoundControl.PerformSelect() +140 System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +68 System.Web.UI.WebControls.GridView.DataBind() +5 System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +61 System.Web.UI.WebControls.CompositeDataBoundControl.CreateChildControls() +67 System.Web.UI.Control.EnsureChildControls() +97 System.Web.UI.Control.PreRenderRecursiveInternal() +50 System.Web.UI.Control.PreRenderRecursiveInternal() +171 System.Web.UI.Control.PreRenderRecursiveInternal() +171 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5731
I hope this helps? Thanks|||
Yes, it compiles in the "Execute Query" in the "Query Builder", but when I click next, and it is supposed to Test the query, it doesnt work. Then it gives me an error when I try to ctrl F5,
DataBinding: 'System.Data.DataRowView' does not contain a property with the name 'ID'.
Description:An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details:System.Web.HttpException: DataBinding: 'System.Data.DataRowView' does not contain a property with the name 'ID'.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.Stack Trace:
[HttpException (0x80004005): DataBinding: 'System.Data.DataRowView' does not contain a property with the name 'ID'.] System.Web.UI.DataBinder.GetPropertyValue(Object container, String propName) +198 System.Web.UI.WebControls.GridView.CreateChildControls(IEnumerable dataSource, Boolean dataBinding) +2775 System.Web.UI.WebControls.CompositeDataBoundControl.PerformDataBinding(IEnumerable data) +59 System.Web.UI.WebControls.GridView.PerformDataBinding(IEnumerable data) +12 System.Web.UI.WebControls.DataBoundControl.OnDataSourceViewSelectCallback(IEnumerable data) +101 System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +25 System.Web.UI.WebControls.DataBoundControl.PerformSelect() +140 System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +68 System.Web.UI.WebControls.GridView.DataBind() +5 System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +61 System.Web.UI.WebControls.CompositeDataBoundControl.CreateChildControls() +67 System.Web.UI.Control.EnsureChildControls() +97 System.Web.UI.Control.PreRenderRecursiveInternal() +50 System.Web.UI.Control.PreRenderRecursiveInternal() +171 System.Web.UI.Control.PreRenderRecursiveInternal() +171 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5731
I hope this helps? Thanks|||Hi dotnetjunkie17,
Yes, it compiles in the "Execute Query" in the "Query Builder", but when I click next, and it is supposed to Test the query, it does not work
Since your sql query string even doesn't pass the "Query Builder" , there should be something wrong with your sql query string itself.
I've checked your query string, and find some errors. You cannot use INNER JOIN that way, to correct your errors, following the above code:
SELECT TBLPROJECTS.NAME,
TBLPROJECTTYPES.NAME AS PROJECTTYPE,
TBLPROJECTS.DESCRIPTION,
TBLUSERS_1.LOGIN AS OWNERNAME,
TBLUSERS.LOGIN AS MANAGERNAME,
TBLPROJECTS.START_DATE,
TBLPROJECTS.END_DATE,
TBLAOI.NAME AS AREAOFINTEREST,
TBLPROJECTS.MANPOWER,
TBLUNITS.NAME AS MANPOWERUNIT
FROM
TBLPROJECTS
INNER JOIN
TBLAOI ON TBLPROJECTS.AOI_ID = TBLAOI.ID
INNER JOIN
TBLPROJECTTYPES ON TBLPROJECTS.PROJECTTYPE_ID = TBLPROJECTTYPES.ID
INNER JOIN
TBLUNITS ON TBLPROJECTS.MANPOWERUNITS_ID = TBLUNITS.ID
INNER JOIN
TBLUSERS ON TBLPROJECTS.MANAGER_ID = TBLUSERS.ID
INNER JOIN
TBLUSERS TBLUSERS_1 ON TBLPROJECTS.OWNER_ID = TBLUSERS_1.ID
Saturday, February 11, 2012
@working_directory
various customer sites that purchase our product. As I have no way of
knowing which drive they will use for data and log file storage I would like
to set the @.working_directory parameter for sp_adddistpublisher to null.
Will this cause the default UNC (\\<servername>\<drive letter>$\Program
Files\Microsoft SQL Server\MSSQL\ReplData) to be used?
Thanks,
Mark
Hi Mark, the SQL2005 version of sp_adddistpublisher will provide the
behavior that you want but unfortunately the change has not been (and will
unlikey be) backported to any versions of SQL2000. In SQL2005, we use the
following xp_instance_regread call to find out the root data folder path of
SQL Server so you may be able to do something similar:
EXECUTE @.retcode = master.dbo.xp_instance_regread
'HKEY_LOCAL_MACHINE',
'SOFTWARE\Microsoft\MSSQLServer\Setup',
'SQLDataRoot',
@.param = @.working_directory OUTPUT,
@.no_output = 'no_output'
Hope that helps.
-Raymond
"mrprice" <mrprice@.discussions.microsoft.com> wrote in message
news:22060AF0-414E-4BA0-8C98-FA643FCFB83C@.microsoft.com...
> We are trying to create generic scripts to enable/configure replication at
> various customer sites that purchase our product. As I have no way of
> knowing which drive they will use for data and log file storage I would
> like
> to set the @.working_directory parameter for sp_adddistpublisher to null.
> Will this cause the default UNC (\\<servername>\<drive letter>$\Program
> Files\Microsoft SQL Server\MSSQL\ReplData) to be used?
> Thanks,
> Mark
>
|||Raymond,
As it needs to be a UNC, I'm doing this? Look reasonable?
DECLARE @.retcode INT
DECLARE @.pubworkingdir SYSNAME
EXECUTE @.retcode = master.dbo.xp_instance_regread
'HKEY_LOCAL_MACHINE',
'SOFTWARE\Microsoft\MSSQLServer\Replication',
'WorkingDirectory',
@.pubworkingdir OUTPUT,
'no_output'
SET @.pubworkingdir = '\\' + @.@.SERVERNAME + '\' + REPLACE(@.pubworkingdir,
':', '$')
Thanks,
Mark
|||You may want to use serverproperty('MachineName') instead of @.@.servername to
get the "real" server name. Other than that, your code snippet looks fine to
me (you should, of course, test it extensively in your environment...)
"mrprice" <mrprice@.discussions.microsoft.com> wrote in message
news:060F1CA5-EDCE-4EC8-824A-CD5F12F05D21@.microsoft.com...
> Raymond,
> As it needs to be a UNC, I'm doing this? Look reasonable?
> DECLARE @.retcode INT
> DECLARE @.pubworkingdir SYSNAME
> EXECUTE @.retcode = master.dbo.xp_instance_regread
> 'HKEY_LOCAL_MACHINE',
> 'SOFTWARE\Microsoft\MSSQLServer\Replication',
> 'WorkingDirectory',
> @.pubworkingdir OUTPUT,
> 'no_output'
> SET @.pubworkingdir = '\\' + @.@.SERVERNAME + '\' + REPLACE(@.pubworkingdir,
> ':', '$')
> Thanks,
> Mark
@variable in SELECT ... WHERE ... IN clause
Is there a way to create a query that can be like:
DECLARE @.group_id_list varchar(100)
SET @.group_id_list='100,101,150'
SELECT * FROM abc WHERE abc_id IN (@.group_id_list)
I get the error "Syntax error converting the varchar value '100,101,150' to a column of data type int.
Do I need to resort to a dynamic SQL statement?
You do.|||Not if you don't want to. In many cases I prefer to use a udf that I've created that takes a comma-delimited varchar and returns a table. Then you can either join on the table to limit your results, or you can use IN (SELECT id FROM Split(@.param,DEFAULT) alias1) in your where clause. The second param into my Split UDF is what the separator is (default is comma).|||Thank you. I actually ended up doing something similar (never thought of using a UDF):
DECLARE @.groups TABLE (group_id int)
I ran a while loop inserting the values into the @.groups table, then used:
SELECT * FROM abc WHERE abc_id IN (SELECT group_id FROM @.groups)
I don't know if it's efficient, but my dynamic SQL statement was going to exceed 14k in length!