Showing posts with label default. Show all posts
Showing posts with label default. Show all posts

Friday, March 30, 2012

If Isnull Question

I have a SP I am trying to set a value for a variable in. The default value
for the variable is Null.
If there is not parameter passed I want to do an If Isnull statement to set
the variable in the SP, except I keep recveiving an incorrect Syntax error.
If any one can suggest a fix I would greatly appreciate it.
Here is my statement
If IsNull(Convert(VarChar(50), @.Client), Set @.Client in ('HUD601Solomon',
'Citi Special Servicing', 'HUD601SalomonDeal3'))
Thanks
-ChrisYou should look up the IF statement in Books Online, also look at how
variables should be checked for null values.

> If IsNull(Convert(VarChar(50), @.Client), Set @.Client in ('HUD601Solomon',
> 'Citi Special Servicing', 'HUD601SalomonDeal3'))
Is this a part of a query? Then you should also look up the CASE expression
in Books Online.
After you're done with BOL, check out this recent thread:
http://msdn.microsoft.com/newsgroup...5f-b8940be08178
I'm guessing you want something like that.
ML
http://milambda.blogspot.com/|||you want "if @.Client is null. "
isnull is a function which will replace a null occurence with a value
"@.Client is null" is using the is keyword, which will do an equality
check(ish - null != null).
beware not to use if @.Client = null as this will not work.sql

Monday, March 19, 2012

Identity Seed : Implications of making it zero

Hi,
The default for the seed is 1. HAs anyone tried creating a
seed starting at 0 instead. What are the problems/comments
on this?
Any feedback is appreciated.
Thanks
AnnaImplication will be that you'll get one extra possible value :)
Seriously, no problem at all. You can use negative numbers if you want.
Everyone just pretty much uses 1 due to convention.
"Anna" <anonymous@.discussions.microsoft.com> wrote in message
news:0c0601c49a7c$4d843a30$a601280a@.phx.gbl...
> Hi,
> The default for the seed is 1. HAs anyone tried creating a
> seed starting at 0 instead. What are the problems/comments
> on this?
> Any feedback is appreciated.
> Thanks
> Anna|||No problems, your new identity values will start from 0 instead of 1.
--
Vyas, MVP (SQL Server)
http://vyaskn.tripod.com/
"Anna" <anonymous@.discussions.microsoft.com> wrote in message
news:0c0601c49a7c$4d843a30$a601280a@.phx.gbl...
> Hi,
> The default for the seed is 1. HAs anyone tried creating a
> seed starting at 0 instead. What are the problems/comments
> on this?
> Any feedback is appreciated.
> Thanks
> Anna|||> Everyone just pretty much uses 1 due to convention.
And then get an overflow when the value reaches maxint. ;-)
Seriously, Anna, it even makes more sense to start with the lowest int in
potentially big tables.
--
BG, SQL Server MVP
www.SolidQualityLearning.com
"Adam Machanic" <amachanic@.hotmail._removetoemail_.com> wrote in message
news:ulUM8znmEHA.3396@.tk2msftngp13.phx.gbl...
> Implication will be that you'll get one extra possible value :)
> Seriously, no problem at all. You can use negative numbers if you want.
> Everyone just pretty much uses 1 due to convention.
>
> "Anna" <anonymous@.discussions.microsoft.com> wrote in message
> news:0c0601c49a7c$4d843a30$a601280a@.phx.gbl...
>> Hi,
>> The default for the seed is 1. HAs anyone tried creating a
>> seed starting at 0 instead. What are the problems/comments
>> on this?
>> Any feedback is appreciated.
>> Thanks
>> Anna
>|||"Itzik Ben-Gan" <itzik@.REMOVETHIS.SolidQualityLearning.com> wrote in message
news:uI0F4GomEHA.3356@.TK2MSFTNGP14.phx.gbl...
> And then get an overflow when the value reaches maxint. ;-)
>
The proactive DBA would have re-seeded before hitting that!

identity range check constraint

SQL 2005 merge replication.
I took the defaults on an article for publication - auto identity
management and the default ranges. If I attempt to insert >2000 rows
(the size of the 2 ranges assigned), I recieve the following error:
The insert failed. It conflicted with an identity range check
constraint in database 'DHD_73', replicated table
'dbo.tblAlaska_Facility_Manager', column 'facilityID'. If the identity
column is automatically managed by replication, update the range as
follows: for the Publisher, execute sp_adjustpublisheridentityrange;
for the Subscriber, run the Distribution Agent or the Merge Agent.
Does this mean I cannot do an insert of more than 2000 rows at a time
to this particular article?
TIA,
john g.
Sorry, I forgot to add, I am doing the inserts on the publisher
jg
jgmein...@.gmail.com wrote:
> SQL 2005 merge replication.
> I took the defaults on an article for publication - auto identity
> management and the default ranges. If I attempt to insert >2000 rows
> (the size of the 2 ranges assigned), I recieve the following error:
> The insert failed. It conflicted with an identity range check
> constraint in database 'DHD_73', replicated table
> 'dbo.tblAlaska_Facility_Manager', column 'facilityID'. If the identity
> column is automatically managed by replication, update the range as
> follows: for the Publisher, execute sp_adjustpublisheridentityrange;
> for the Subscriber, run the Distribution Agent or the Merge Agent.
> Does this mean I cannot do an insert of more than 2000 rows at a time
> to this particular article?
> TIA,
> john g.
|||You can batch up the inserts, or increase the size of the assigned rabge,
otherwise you're stuck.
Cheers,
Paul Ibison SQL Server MVP, www.replicationanswers.com .
|||Check the constraint to see what the range is. You can insert up to this
value and then run a sync. This should update the range.
Hilary Cotter
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com
<jgmeinder@.gmail.com> wrote in message
news:1167937361.253647.109410@.51g2000cwl.googlegro ups.com...
> SQL 2005 merge replication.
> I took the defaults on an article for publication - auto identity
> management and the default ranges. If I attempt to insert >2000 rows
> (the size of the 2 ranges assigned), I recieve the following error:
> The insert failed. It conflicted with an identity range check
> constraint in database 'DHD_73', replicated table
> 'dbo.tblAlaska_Facility_Manager', column 'facilityID'. If the identity
> column is automatically managed by replication, update the range as
> follows: for the Publisher, execute sp_adjustpublisheridentityrange;
> for the Subscriber, run the Distribution Agent or the Merge Agent.
> Does this mean I cannot do an insert of more than 2000 rows at a time
> to this particular article?
> TIA,
> john g.
>